Is join useful for every monad?

Georgi Lyubenov godzbanebane at gmail.com
Mon Oct 14 06:46:40 UTC 2019


Often you encounter functions that look weird at a first glance but turn
out to be *exactly* what you need to implement something intuitively "more
useful".
Apart from Dmitrii's example showing some direct usage, I think this is
such one case, as it allows you to implement (>>=) ma f = join (fmap f ma)
Other examples (subjectively of course) of such things are (<*>) which
allows you to implement liftA{2,3,..} and mfix, which allows you to have
recursive bindings in a do block.

=======
Georgi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20191014/db89e93d/attachment.html>


More information about the Libraries mailing list