[Haskell-cafe] return in Monad class necessary?
jonathanccast at fastmail.fm
Tue Nov 27 00:15:52 EST 2007
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 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?
As has been said, this isn't a big issue, and return is quite
useful. Furthermore, I can think of several cases where it would be
awkward (to say the least) to dispense with return, and it's an
invaluable base case for inductive definitions, e.g. of liftMn (which
would have to replace it, I suppose). And besides that, if there is
one thing Haskellers believe more than anything else, it must surely
be that every associative operator deserves a unit...
More information about the Haskell-Cafe