Pattern synonyms in hs-boot files
Pattern synonyms are not permitted in hs-boot files:
ezyang@sabre:~/bun$ ghc-head -c A.hs-boot
A.hs-boot:3:5: error:
Misplaced pattern synonym signature: pattern X :: Bool
|
3 | pattern X :: Bool
| ^^^^^^^^^^^^^^^^^
A.hs-boot:3:13: error:
The pattern synonym signature for ‘X’ lacks an accompanying binding
|
3 | pattern X :: Bool
|
There isn't really any reason why they shouldn't be supported.
One thing to check closely: if we bundle a pattern synonym declared in an hs-boot file with another type, in an hs-boot file, what happens? In particular, does an hs file which doesn't bundle the pattern synonym and the type valid?
If we add support for them, make sure that Backpack signatures handle it properly. In particular, suppose we have:
signature A(T(X)) where
data T
pattern X :: T
Then, when we instantiate A, we must be careful to NOT blindly reuse the implementing module of T for X (as we do today in uAvailInfo
in NameShape
), since T and X may be defined in different modules.
I'm not likely to implement this unless someone asks.
Trac metadata
Trac field | Value |
---|---|
Version | 8.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | low |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |