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

 * cc: illissius@… (added)


Comment:

 > 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

 > My own gut feel is that it's a lot better to have an initial symbol to
 say "here comes a function".


 I don't think I agree with this. Maybe the word 'lambda' in the name of
 the proposal is misleading; I don't think the intuition here should be
 that of a lambda. I think it should be (and was originally) partial
 application. I think it's very natural for any Haskell programmer that if
 you have a function, and you apply it less than fully, that what you end
 up with is a function. The only difference here is that the argument sits
 in between the 'case of' rather than after the name of the function, but I
 don't think that's a big obstacle; it's universally obvious that case-of
 is special. I think the originally proposed 'case of' syntax is elegant
 and intuitive.

 I'm much more ambivalent about if-then-else. It would make sense for
 completeness's sake, but it's a lot uglier (due to having multiple
 unorthodoxly-positioned arguments) and I don't see nearly as much of a use
 case. (It also, unlike 'case of', doesn't feel intuitive -- this is just a
 gut feel and I don't really have any arguments to explain why, but then
 again, the only real definition of intuitivity is whether people feel that
 way...) I think I'd rather just put ifThenElse in the Prelude and have
 people use that if they want to partially apply it (which isn't possible
 with case-of).

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to