#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
---------------------------------+------------------------------------------

Comment(by simonmar):

 Replying to [comment:31 claus]:
 > Some of the syntax suggestions here scare me. But even if an
 unproblematic syntax could be found, do you really want to add a complex
 language construct with limited usage pattern?

 I'm really surprised by both "complex language construct" and "limited
 usage pattern" here, since those are both issues that I thought the
 proposal addresses quite well.

  * complex: we're re-using existing syntax and translations.  The
 specification should be entirely straightforward (thought admittedly I
 haven't tried writing it down yet).  The syntax is consistent with the
 rest of the language; it seems to me  a natural generalisation.  It's just
 an anonymous version of multi-equation function definitions, and the
 syntax is exactly what you'd expect.

  * limited usage pattern: it covers all the use cases that came up in the
 discussion: lambda-case, lambda-if (both with multiple arguments) and also
 `mcase` and `mif`.


 > While I'm here: have you looked at [http://hackage.haskell.org/trac
 /haskell-prime/ticket/114 introduce lambda-match (explicit match failure
 and fall-through)], from around the same time as lambda-case? At the time,
 it was implemented as a small parser modification, with most of the
 functionality in a library (see [http://hackage.haskell.org/trac/haskell-
 prime/ticket/114#attachments ticket attachments] for patch, library, and
 some examples), and 'case'-as-a-function was easy to implement in terms of
 it. But it also supported other useful programming patterns.

 Yes, I remember it, though I'd have to go and review the discussion to
 fully understand the motivation.  On the face of it the syntax looks a bit
 strange (vertical bar is re-used).

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4359#comment:33>
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