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

GHC ghc-devs at haskell.org
Mon Jul 20 02:28:00 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):

 I'm not in strong favor of any proposal of this sort, but I also haven't
 used pattern synonyms much, so my opinion is not well informed.

 But I do think my proposal answers Simon's first point: the programmer
 says explicitly what should be included by any import of a datatype. This
 choice is checked in my proposal, but I don't imagine that would be a
 challenge to implement. The interface file would indicate what pattern
 synonyms are included with a datatype. It all doesn't seem very
 complicated.

 As for smart constructors: I think that pattern synonyms subsume
 traditional "smart constructors". They should really be pattern synonyms
 now! With the change proposed in this ticket, clients might not even know
 the difference between a real constructor and a smart one.

 Here might be a motivation and a design principle for this feature: a
 library should be able to refactor a concrete data type without affecting
 client code. This refactoring would require exporting pattern synonyms
 mimicking the old behavior. But it's conceivable a client would never
 know.

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


More information about the ghc-tickets mailing list