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

GHC cvs-ghc at haskell.org
Wed Oct 6 05:30:23 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 simonpj):

 Chatting to Simon we came up with this syntax:
 {{{
   \case { blah }  ==>   \x -> case x of { blah }
 }}}
 Things to note:

  * No syntactic collision: at the moment a lambda cannot be followed by
 the keyword `case`.

  * The form (a) denotes a function, and (b) starts with a lambda.  That's
 consistent with Haskell today.

  * The `\case` would be a "layout herald" (ie starts a laid-out block),
 just as `of` is now.  (A variant would be to use `\of` instead of `\case`;
 then `of` is the layout herald in both cases.)

  * The syntax of `{ blah }` is precisely that of a case expression, guards
 and all.  Nothing new to explain.

 I rather like this.  I can't think why we didn't think of it before.

 Simon

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


More information about the Glasgow-haskell-bugs mailing list