[GHC] #10653: PatternSynonyms should be imported/exported as part of the wildcard notation
GHC
ghc-devs at haskell.org
Sat Sep 19 20:09:20 UTC 2015
#10653: PatternSynonyms should be imported/exported as part of the wildcard
notation
-------------------------------------+-------------------------------------
Reporter: gridaphobe | Owner: mpickering
Type: feature request | Status: new
Priority: high | Milestone: 8.0.1
Component: Compiler | Version: 7.11
Resolution: | Keywords:
| PatternSynonyms, pattern synonyms
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by simonpj):
I just want to check that you really intend this to work
{{{
module M( Maybe(P) ) where
pattern P x y = (x, True, y)
module N( T(P, X, Y) ) where
import M( Maybe(..) )
data T = X | Y
}}}
Pattern synonym `P` has ''absolutely nothing'' to do with the `Maybe`, but
as I understand it module `M` is legal under this proposal, and anyone
going `import M( Maybe(..) )` will get `P` in scope.
Then module `N` gets the `P` from the import, and attaches it to the also-
unrelated data type `T`.
I think it's all well-defined, but perhaps rather surprising. Is there a
consensus that this is the behaviour we all want; or has it perhaps simply
not been discussed?
A possible restriction might be that you can only add `P` to an export of
a data type `T` if `P`'s type has form `... -> T t1 ..tn`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10653#comment:30>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list