Re: [Haskell-cafe] return in Monad class necessary?

2007-11-27 Thread David Menendez
On Nov 27, 2007 4:45 AM, Chris Eidhof <[EMAIL PROTECTED]> wrote: > First, some people want to use return just as an imperative programmer > would use it: to exit from a function. So the programmer doesn't > expect the commands after that return are executed. > This is more a problem with the name

Re: [Haskell-cafe] return in Monad class necessary?

2007-11-27 Thread Chris Eidhof
On 27 nov 2007, at 10:14, Reinier Lamers wrote: Chris Eidhof wrote: On 26 nov 2007, at 19:48, Henning Thielemann wrote: I wonder whether it is a typical mistake of beginners to write 'return' within a do-block (that is, not at the end) and if it is possible to avoid this mistake by clever typ

Re: [Haskell-cafe] return in Monad class necessary?

2007-11-27 Thread Reinier Lamers
Chris Eidhof wrote: On 26 nov 2007, at 19:48, Henning Thielemann wrote: I wonder whether it is a typical mistake of beginners to write 'return' within a do-block (that is, not at the end) and if it is possible to avoid this mistake by clever typing. In a proper monad 'return' can be fused with

Re: [Haskell-cafe] return in Monad class necessary?

2007-11-26 Thread Jonathan Cast
On 26 Nov 2007, at 10:48 AM, Henning Thielemann wrote: I wonder whether it is a typical mistake of beginners to write 'return' within a do-block (that is, not at the end) and if it is possible to avoid this mistake by clever typing. In a proper monad 'return' can be fused with subsequent action

Re: [Haskell-cafe] return in Monad class necessary?

2007-11-26 Thread Neil Mitchell
Hi Henning, > I wonder whether it is a typical mistake of beginners > to write 'return' within a do-block (that is, not at the end) > and if it is possible to avoid this mistake by clever typing. There are legitimate uses of return inside a do, see: http://www.cs.york.ac.uk/fp/darcs/catch/catch_1

Re: [Haskell-cafe] return in Monad class necessary?

2007-11-26 Thread Derek Elkins
On Tue, 2007-11-27 at 00:15 +0100, Chris Eidhof wrote: > On 26 nov 2007, at 19:48, Henning Thielemann wrote: > > I wonder whether it is a typical mistake of beginners > > to write 'return' within a do-block (that is, not at the end) > > and if it is possible to avoid this mistake by clever typing.

Re: [Haskell-cafe] return in Monad class necessary?

2007-11-26 Thread Chris Eidhof
On 26 nov 2007, at 19:48, Henning Thielemann wrote: I wonder whether it is a typical mistake of beginners to write 'return' within a do-block (that is, not at the end) and if it is possible to avoid this mistake by clever typing. In a proper monad 'return' can be fused with subsequent actions, an

Re: [Haskell-cafe] return in Monad class necessary?

2007-11-26 Thread Bulat Ziganshin
Hello Henning, Monday, November 26, 2007, 9:48:29 PM, you wrote: > I wonder whether it is a typical mistake of beginners > to write 'return' within a do-block (that is, not at the end) don't forget that `return` is also used to force evaluation: do let n = a+b return $! n writeChan c (n,1

[Haskell-cafe] return in Monad class necessary?

2007-11-26 Thread Henning Thielemann
I wonder whether it is a typical mistake of beginners to write 'return' within a do-block (that is, not at the end) and if it is possible to avoid this mistake by clever typing. In a proper monad 'return' can be fused with subsequent actions, and thus it is not necessary within a sequence of actio