
20 Sep
2005
20 Sep
'05
8:14 a.m.
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