Re: [Haskell-cafe] case of (was: [Haskell] Mixing monadic and non-monadic functions)

2005-09-20 Thread Henning Thielemann
On Mon, 19 Sep 2005, Andrew Pimlott wrote: On Sat, Sep 17, 2005 at 06:56:36PM +0100, Ben Rudiak-Gould wrote: * The new syntax is really nice as a replacement for the annoyingly common x - foo ; case x of... idiom that I've always disliked. I might wish for case of to mean \x - case

Re: [Haskell-cafe] case of (was: [Haskell] Mixing monadic and non-monadic functions)

2005-09-20 Thread Sven Moritz Hallberg
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

Re: [Haskell-cafe] case of (was: [Haskell] Mixing monadic and non-monadic functions)

2005-09-20 Thread Bernard Pope
On Tue, 2005-09-20 at 10:14 +0200, Sven Moritz Hallberg wrote: 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.,

Re: [Haskell-cafe] case of (was: [Haskell] Mixing monadic and non-monadic functions)

2005-09-20 Thread Donn Cave
On Tue, 20 Sep 2005, Bernard Pope wrote: On Tue, 2005-09-20 at 10:14 +0200, Sven Moritz Hallberg wrote: Donn Cave schrieb: ... but how do you write getArgs = \ [] - putStrLn (no arguments) (a:_) - putStrLn (show a) What about good old let? main = getArgs

[Haskell-cafe] case of (was: [Haskell] Mixing monadic and non-monadic functions)

2005-09-19 Thread Andrew Pimlott
On Sat, Sep 17, 2005 at 06:56:36PM +0100, Ben Rudiak-Gould wrote: * The new syntax is really nice as a replacement for the annoyingly common x - foo ; case x of... idiom that I've always disliked. I might wish for case of to mean \x - case x of: foo = case of ... Useful outside of

Re: [Haskell-cafe] case of (was: [Haskell] Mixing monadic and non-monadic functions)

2005-09-19 Thread Donn Cave
On Mon, 19 Sep 2005, Andrew Pimlott wrote: On Sat, Sep 17, 2005 at 06:56:36PM +0100, Ben Rudiak-Gould wrote: * The new syntax is really nice as a replacement for the annoyingly common x - foo ; case x of... idiom that I've always disliked. I might wish for case of to mean \x - case x

Re: [Haskell-cafe] case of (was: [Haskell] Mixing monadic and non-monadic functions)

2005-09-19 Thread John Meacham
On Mon, Sep 19, 2005 at 02:17:42PM -0700, Andrew Pimlott wrote: On Sat, Sep 17, 2005 at 06:56:36PM +0100, Ben Rudiak-Gould wrote: * The new syntax is really nice as a replacement for the annoyingly common x - foo ; case x of... idiom that I've always disliked. I might wish for case