[GHC] #9671: Allow expressions in patterns

GHC ghc-devs at haskell.org
Tue Mar 21 09:05:59 UTC 2017


#9671: Allow expressions in patterns
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                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:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Iceland_jack):

 Is this a matter of finding good syntax or is it something fundamental?
 I'll get the ball rolling, help me pick this apart

 {{{#!hs
 pattern Lookup \key val <- (lookup key -> Just val)

 pattern IsMember \val <- (member val -> True)

 -- and they get marked with $ when in pattern
 -- (I'm making this up on the tube)

 age (Lookup $"Alice" age) = ...

 -- Simon's
 f p (Lookup $p p) = p
 }}}

 If it helps we could impose a separation between "argument patterns" and
 patterns.

 I want this feature at least once a week ;) so I self-servingly remain +1
 if this can be sorted

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


More information about the ghc-tickets mailing list