[GHC] #8583: Associated pattern synonyms

GHC ghc-devs at haskell.org
Mon Sep 11 15:22:55 UTC 2017


#8583: Associated pattern synonyms
-------------------------------------+-------------------------------------
        Reporter:  cactus            |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:
      Resolution:                    |             Keywords:
                                     |  PatternSynonyms
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:  5144              |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Iceland_jack):

 Quick reminder: I need this to work with GND. Using an `Int` instance of
 the above class

 {{{#!hs
 deriving instance HasZero Int
 }}}

 I want to be able to derive (`newtype`, not `anyclass`)

 {{{#!hs
 newtype USD = USD Int
   deriving newtype
     HasZero

 -- instance HasZero USD where
 --   pattern Zero :: USD
 --   pattern Zero <- (coerce -> Zero::Int)
 --     where Zero = coerce (Zero::Int)
 }}}

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


More information about the ghc-tickets mailing list