Re:Category Theory for Programmers (2014)
by cousin_it on Tuesday April 04, 2017 @05:28AM
(#14030839)
Functions of type A -> A for some A form a monoid under composition, but functions of arbitrary type don't. The nifty phrase "a monad is just a monoid in the category of endofunctors" doesn't refer to the function composition monoid, but something much stranger, where the "composition" operation has type m (m a) -> m a, and the "identity" operation has type a -> m a. To understand how that can be seen as a monoid, note that the composition operation composes two effects on the same computation, and the identity operation adds an empty effect.
[ Parent
| on HN ]
Re:Category Theory for Programmers (2014)
by BoiledCabbage on Wednesday April 05, 2017 @10:17AM
(#14042225)
> note that the composition operation composes two effects on the same computation, and the identity operation adds an empty effect.
Thanks - While I did have this vague idea, and it says it from the types, seeing it written out in this way was clarifying.