Donn Cave schrieb:

> The ordinary lambda comes close - in ghc anyway, it supports
> pattern matching.  But I can't work out the syntax for multiple
> cases, which would obviously be needed to make it practically
> useful.
> 
> e.g., this seems to be OK:
>     getArgs >>= \ (a:_) -> putStrLn (show a)
> 
> but how do you write
>     getArgs >>= \     [] -> putStrLn "(no arguments)"
>                       (a:_) -> putStrLn (show a)
> 
> (pardon me if I missed where you were going in "case of ...")

Sorry, I'm just jumping into this discussion, but why shouldn't the
above work? I.e. extend lambda to accept a group of patterns:

        \{Pat1 -> exp1; Pat2 -> exp2; Pat3 -> exp3}

?

Regards,
Sven Moritz
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to