… Monads, Profunctors, Categories, Applicatives, and everything else.
Manuel Bärenz
Stream a -> Stream b subtype hierarchy:
a -> b (via fmap)a -> Stream b (via e.g. head)SF)Stream a -> Stream bBut we can also precompose with functions! (A.k.a Contravariant.)
f gives several canonical profunctors:
a -> f b (Kleisli)f a -> b (Cokleisli, irrelevant today)f a -> f b(.) and fmap.Profunctor gives you back a Functor..
rmapProfunctor from that!SFIn the Functor-Applicative-Monad-hierarchy, people sometimes insert Arrow.
arr and (>>>) generalise lmap and rmap.m gives several canonical arrows:
a -> m b (Kleisli)m a -> b (Cokleisli, irrelevant today)m a -> m b(.) and fmap.Arrow gives you back an Applicative…
&&&)Arrow from that!SF