News for hackers. Stuff that matters.
Re:GHC 7.6 is now live: poly kinds, dynamic use of cores, nu... by dbaupp on Friday September 07, 2012 @01:10PM (#4490097)
Does anyone know how multiple arguments work with lambda-case[1]? Is the solution just using a tuple and manually currying like so (suggested here[2])?

   curry (\case (Nothing,_) -> ...)
(It seems like this would defeat the purpose of lambda-case for lambdas with more than 2 arguments, and it is awkward even for those with exactly 2 arguments.)

[1] http://www.haskell.org/ghc/docs/7.6.1/html/users_guide/synta... [2] http://hackage.haskell.org/trac/ghc/wiki/LambdasVsPatternMat...

Re:GHC 7.6 is now live: poly kinds, dynamic use of cores, nu... by JoshTriplett on Friday September 07, 2012 @03:08PM (#4490662)
Yes, LambdaCase only supports one argument. That covers the most common cases, such as foo >>= \case ...

See the discussions at http://hackage.haskell.org/trac/ghc/ticket/4359 and https://unknownparallel.wordpress.com/2012/07/09/the-long-an... for the history of this.

Multi-argument lambda case proves quite difficult to handle sanely, because normal non-lambda case doesn't do multiple arguments, just tuples. Having multiple arguments requires separating the pattern for each argument somehow, a problem that doesn't come up for non-lambda cases.

Re:GHC 7.6 is now live: poly kinds, dynamic use of cores, nu... by emillon on Friday September 07, 2012 @03:06PM (#4490654)
The equivalent construct in OCaml is "function", and it suffers from the same limitation, and it's quite idiomatic to match on a tuple.
Re:GHC 7.6 is now live: poly kinds, dynamic use of cores, nu... by aristidb on Friday September 07, 2012 @01:31PM (#4490205)
You can still do \a b -> case (a,b) of ...
Re:GHC 7.6 is now live: poly kinds, dynamic use of cores, nu... by thesz on Friday September 07, 2012 @04:21PM (#4491012)
And, perhaps, use uncurry $ \case ...