[Haskell-cafe] return in Monad class necessary?

David Menendez dave at zednenem.com
Tue Nov 27 09:57:30 EST 2007

On Nov 27, 2007 4:45 AM, Chris Eidhof <chris at eidhof.nl> 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. I doubt this particular problem would
arise if return were called something like "pure" (like the equivalent in

I suspect the solution here is better documentation. There are logical
reasons for return to be called "return". We just need to point out to new
programmers that it's not the same as return in other languages. Much like
how Haskell's classes are not like the classes in object-oriented languages.

Incidentally, lots of early monad papers use names like "unit". When did
Haskell settle on the name "return"? My guess is that it has something to do
with the old monad comprehension syntax.

Dave Menendez <dave at zednenem.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071127/fb1280f6/attachment.htm

More information about the Haskell-Cafe mailing list