[GHC] #11461: Allow pattern synonyms to be bundled with type classes?

GHC ghc-devs at haskell.org
Thu Jan 21 20:51:31 UTC 2016


#11461: Allow pattern synonyms to be bundled with type classes?
-------------------------------------+-------------------------------------
        Reporter:  mpickering        |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             Keywords:
                                     |  PatternSynonyms
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 Probably obvious to the pattern synonym cognoscenti but you can change the
 export list to
 {{{
 module Foo(Nullable, pattern Null) where
 }}}
 and use this style today.

 The disadvantages relative to "real" associated patterns are

 * no association between the class and the pattern as far as import/export
 is concerned

 * you have to give a single top-level definition of the pattern synonym,
 and do the per-instance work in an auxiliary function. I think you can
 always do this at negligible cost (other than syntactic noise).

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


More information about the ghc-tickets mailing list