[GHC] #13322: Pattern synonyms in hs-boot files
GHC
ghc-devs at haskell.org
Thu Feb 23 05:07:48 UTC 2017
#13322: Pattern synonyms in hs-boot files
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner: (none)
Type: feature | Status: new
request |
Priority: low | Milestone:
Component: Compiler | Version: 8.1
(Type checker) |
Keywords: hs-boot | Operating System: Unknown/Multiple
backpack |
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Pattern synonyms are not permitted in hs-boot files:
{{{
ezyang at 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.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13322>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list