We can have two types f, g :: * -> * so that they are not monads, but their composition. For example, for an arbitrary fixed s :
fa := s -> a ga := (s, a)
ga not a monad (unless we restrict s monoid), but f (ga) is a state monad s -> (s, a) . (Unlike functors and applicative functors, even if both f and g were monads, their composition may not be .)
Is there a similar example for functors or applicative functors? That is, the composition of f and g is a functor (or an applicative functor), although
- one of
f and g not an (applicative) functor, and the other is either - none of them is a (applicative) functor,
functor composition haskell category-theory applicative
Petr pudlΓ‘k
source share