[Haskell-cafe] Re: proposal: point free case expressions

Eugene Kirpichov ekirpichov at gmail.com
Thu Nov 5 11:02:17 EST 2009


How about \{Left err -> print err; Right msg -> putStrLn msg} ?

2009/11/5 Stefan Monnier <monnier at iro.umontreal.ca>:
>> We could really use a case statement in which we skip the scrutinee and make
>> (case of {})' be syntactic sugar for `(\x -> case x of {})'.
>
>> So we could write:
>
>>> myFunc = anotherFunc $ case of
>>> Left err -> print err
>>> Right msg -> putStrLn msg
>
>> A minor syntactical addition, a big win!
>
> Since this "case" really defines a function, it seems like it would make
> more sense to allow defining anonymous functions by pattern matching.
> I.e. instead of "case of", I think it should use "λ", "\", "fn", or ...
>
>
>        Stefan
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Eugene Kirpichov
Web IR developer, market.yandex.ru


More information about the Haskell-Cafe mailing list