[Haskell-cafe] Lambda-case / lambda-if
lemming at henning-thielemann.de
Sat Oct 2 14:33:18 EDT 2010
On Sat, 2 Oct 2010, Max Bolingbroke wrote:
> Hi Cafe,
> I implemented the proposed Haskell' feature lambda-case/lambda-if 
> during the Haskell Implementors Workshop yesterday for a bit of fun.
> The patches are online [2, 3].
> The feature is demonstrated in this GHCi session:
> $ inplace/bin/ghc-stage2 --interactive -XLambdaCase
> GHCi, version 7.1.20101002: http://www.haskell.org/ghc/ :? for help
> Loading package ghc-prim ... linking ... done.
> Loading package integer-gmp ... linking ... done.
> Loading package base ... linking ... done.
> Loading package ffi-1.0 ... linking ... done.
> Prelude> (if then "Haskell" else "Cafe") False
> Prelude> (case of 1 -> "One"; _ -> "Not-one") 1
> Prelude> :q
> Do you like this feature and think it would be worth incorporating
> this into GHC? Or is it too specialised to be of use? If there is
> enough support, I'll create a ticket and see what GHC HQ make of it.
Nice! Concerning if-then-else I would more like to see an according
function to go to Data.Bool, then we won't need more syntactic sugar like
if-then-else. However the lambda-case would be useful for me.
More information about the Haskell-Cafe