News for hackers. Stuff that matters.
Re:The Lazy Monad by chongli on Tuesday June 07, 2022 @10:44AM (#31655090)
This is a pretty good explanation but it's missing one detail: the laws.

A monad is an applicative functor which is a functor. Each of these concepts in the hierarchy comes with a set of laws which must be obeyed. For example, all functors (which define an operation, fmap) must obey 2 laws:

Identity

fmap id == id

Composition

fmap (f . g) == fmap f . fmap g

All instances of Functor must obey these laws. Furthermore, since every Monad is also a Functor, all instances of Monad also obey these laws (in addition to extra laws).

There are no comments on this comment yet.