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

GHC ghc-devs at haskell.org
Mon Jul 20 07:44:36 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 simonpj):

 Well I certainly agree with the goal of being oblivious to library
 refactorings.

 I don't yet understand Richard's proposal.  Perhaps you mean this:

  * Let's say that the data constructors of a type `T` are "associated with
 `T`".

  * When you say `T(..)` in an export or import list, you mean `T` plus all
 its in-scope associated constructors.

  * In the defining module of a data type (''and nowhere else'') you can
 list pattern synonyms in the export list thus `T( ..., pattern A1 )`, and
 that permanently associates `A1` with `T`.

 Is that what you intended?  Well that is certainly better.  It means that
 there is one place to go to find out the full list of what `T(..)` might
 mean, namely the module where `T` is defined.

 But I dislike that you have to look (a) at the definition of `T` and (b)
 at the exports of the module.  Somehow the definition of `T` should tell
 you everything. Something like
 {{{
 data T = A Int | B [Bool]
        with( P, Q, R )

 pattern P x = B [x]
 ...etc...
 }}}

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


More information about the ghc-tickets mailing list