Created: 2023-02-15 09:26
Function composition is a Monoid:
Associativity
f . (g . h) = (f . g) . h
Identity
f . id = id . f = f
Kleisli composition is composition lifted to a Monadic context:
(.) :: (b -> c) -> (a -> b) -> (a -> c)
(<=<) :: (b -> m c) -> (a -> m b) -> (a -> m c)
And thus itβs also a Monoid, where pure
is the identity.
Associativity
f <=< (g <=< h) = (f <=< g) <=< h
Identity
f <=< pure = pure <=< f = f