[Haskell-cafe] return in Monad class necessary?

Derek Elkins derek.a.elkins at gmail.com
Mon Nov 26 19:41:10 EST 2007

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.
> > In a proper monad 'return' can be fused with subsequent actions,
> > and thus it is not necessary within a sequence of actions.
> > However, although sensible, 'return' is also not required at the end  
> > of a block.
> > Has someone already thought about a replacement for monads?
> I also made that mistake in the beginning, I used return instead of  
> lets. I don't think it's a big problem, most users will find out once  
> they've got some more experience, and it doesn't really do any harm.

I may be mistaken, but I'm pretty sure he's talking about something
different.  Basically, where 'return' is confused for C's return.  I
have seen this occasionally in #haskell or on the mailinglist, but it
doesn't seem to be a big issue.  It doesn't come up all that often and
it's usually quickly resolved.

More information about the Haskell-Cafe mailing list