Functor composition.
Comp f g a is equivalent to
f
(g a), and the
Comp pattern synonym is a way of getting
the
f (g a) in a
Comp f g a.
For example,
Maybe (IO Bool) is
Comp Maybe IO Bool.
This is mostly useful for its typeclass instances: in particular,
Functor,
Applicative,
HBifunctor, and
Monoidal.
This is essentially a version of
:.: and
Compose that
allows for an
HBifunctor instance.
It is slightly less performant. Using
comp .
unComp every once in a while will concretize a
Comp
value (if you have
Functor f) and remove some
indirection if you have a lot of chained operations.
The "free monoid" over
Comp is
Free, and the "free
semigroup" over
Comp is
Free1.