3 ms·
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 hi
by chongli 4y ago
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).