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

GHC cvs-ghc at haskell.org
Wed Oct 6 01:33:40 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 isaacdupree):

 Replying to [comment:4 simonmar]:
 > hmm, on second thoughts I revise that to +0 for lambda-case and lambda-
 if.  They save a constant number of tokens (4), but the downside is that
 we have to adjust our mental parsers/typecheckers to recognise `if then`
 and `case of` as a lambda, and I'm not sure the gain in brevity is worth
 the loss of readability.  (note that multi-way if doesn't suffer from this
 problem, it's just an abbreviation).

 "They save a constant number of tokens (4)" -- this is true, but the
 overhead is a bit more than just the tokens "\" "x" "->" (case) "x" (of
 ...).  There's the mental complication of that name "x".  You need to
 think, reading it: Is 'x' used anywhere later under the case/lambda?(no).
 And writing it: Are there variables named 'x' that we're accidentally
 shadowing, or otherwise using the same name confusingly?

 I'm open to other suggestions than lambda-case/lambda-if that would help
 this mental-overhead issue.

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


More information about the Glasgow-haskell-bugs mailing list