←back to thread

A list is a monad

(alexyorke.github.io)
153 points polygot | 1 comments | | HN request time: 0.278s | source
Show context
revskill ◴[] No.44445883[source]
U must prove it is a monoid in the category of endofuncors.
replies(2): >>44446065 #>>44447702 #
1. rebeccaskinner ◴[] No.44446065[source]
join has the type `m (m a) -> m a`. That's the thing that really shows off the monoidal structure. People normally implement monads in terms of bind, but you can easily define join in terms of bind for any Monad: `join ma = ma >>= id`. So really, as long as you have a lawful instance of Monad written with bind the existence of join is your proof.