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

GHC ghc-devs at haskell.org
Tue Jul 21 04:12:06 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 rwbarton):

 I think Richard's proposal already allows this, but I would add that there
 is likely some real value in allowing a module to associate a pattern
 synonym with a type constructor even when the module is not the one in
 which the type constructor is defined. It's a common organization to put a
 bunch of types in a single, sometimes "internal", module (to avoid import
 loops) and then define functions involving those types in many different
 modules (to avoid having one giant module of doom). Pattern synonyms can
 involve nontrivial functions if they use view patterns (think of Data.Seq
 for instance) so it would be useful to associate a pattern synonym with a
 data type in a top-level module that consists of re-exports.

 On the subject of requiring pattern synonyms attached to type constructors
 to have that type constructor in outermost position in their type, what
 about polymorphic pattern synonyms? Doesn't it make sense to write
 something like
 {{{
 pattern Nil = (Foldable.null -> True)
 }}}
 where `Nil` matches an expression of type `Foldable t => t a`? What is the
 rule then?

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


More information about the ghc-tickets mailing list