Is join useful for every monad?

Vanessa McHale vamchale at gmail.com
Mon Oct 14 21:24:08 UTC 2019


You can use the (-> c) instance in fun ways

both :: (a -> b) -> (a, a) -> (b, b)
both = join (***)

dup :: a -> (a, a)
dup = join (,)

between `join` (char '"')

On 10/13/19 11:55 PM, Dannyu NDos wrote:
> join is surely useful for Maybe and [].
>
> But IO (IO a)? ReadPrec (ReadPrec a)? ST s (ST s a)? When the heck
> could I encounter such types?
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20191014/219bb102/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20191014/219bb102/attachment.sig>


More information about the Libraries mailing list