[GHC] #10653: PatternSynonyms should be imported/exported as part of the wildcard notation

GHC ghc-devs at haskell.org
Sat Jul 18 19:36:26 UTC 2015


#10653: PatternSynonyms should be imported/exported as part of the wildcard
notation
-------------------------------------+-------------------------------------
        Reporter:  gridaphobe        |                   Owner:
            Type:  feature request   |                  Status:  new
        Priority:  normal            |               Milestone:  7.12.1
       Component:  Compiler          |                 Version:  7.11
      Resolution:                    |                Keywords:  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 goldfire):

 If `Q` belongs to pairs, then is it ever imported with `(..)` attached to
 some type? I would guess "no".

 I agree that the attachment of patterns to datatypes like this is fishy,
 but I see gridaphobe's point that it would be nice to shield the use of
 synonyms from clients. What if there were a way to declare that a pattern
 is attached to a type? For example:

 {{{
 module A ( A(.., pattern A1) ) where ...
 }}}

 By adding `A1` to the export list of the type `A`, then it is imported
 with `A` as well. We would probably want a check that `A1`'s result type
 is indeed headed by `A`. This seems to make sense in re-exports as well,
 in case the pattern synonyms and original datatype are defined in
 different modules.

 (The use of the `pattern` keyword in there is redundant, but I like it
 anyway. Others may disagree.)

 gridaphobe, does this address your need?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10653#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list