[GHC] #4359: Implement lambda-case/lambda-if

GHC cvs-ghc at haskell.org
Wed Oct 6 10:47:45 EDT 2010


#4359: Implement lambda-case/lambda-if
---------------------------------+------------------------------------------
    Reporter:  batterseapower    |        Owner:              
        Type:  feature request   |       Status:  new         
    Priority:  normal            |    Milestone:              
   Component:  Compiler          |      Version:  7.1         
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by batterseapower):

 Another variant would be something like this:

 {{{
 \case { (Just x) (Just y) -> x + y; _ _ -> 1 }  ==> \a b -> case (a, b) of
 { (Just x, Just y) -> x +y; (_, _) -> 1 }
 }}}

 This syntax would give us multi-argument lambdas that do arbitrary pattern
 matching, without problematic syntax like this:

 {{{
 \(Just x) (Just y) -> x + y; _ _ -> 1
 }}}

 However, it does mean that we would have to parse rather differently than
 a standard case. For example this would not be valid:

 {{{
 \case { Just x -> 1 }
 }}}

 Because it would parse as a two argument function with the second argument
 bound to x and the first argument bound to the invalid name Just.

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


More information about the Glasgow-haskell-bugs mailing list