[GHC] #10928: Refine pattern synonym signatures

GHC ghc-devs at haskell.org
Wed Oct 7 12:10:16 UTC 2015


#10928: Refine pattern synonym signatures
-------------------------------------+-------------------------------------
        Reporter:  mpickering        |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Other             |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 I'm actually coming around to the original syntax, but with the
 constraints reversed as in comment:5. It's not so bad and it can be
 extended to support required values too, using an empty provided
 constraint if needed.
 {{{
 pattern IsMember :: Ord a => a -> () => Set a
 pattern IsMember val <- (member val -> True)

 pattern Lookup :: Ord k => k -> () => v -> Map k v
 pattern Lookup key val <- (lookup key -> Just val)
 }}}
 I have to say writing these pattern signatures was a bit mind-bending, but
 I don't think that's because of the particular concrete syntax involving
 constraints.

 I still feel that maybe we ought to be able to do better, but I consider
 this solution at least satisfactory.

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


More information about the ghc-tickets mailing list