Can two non-functors make up a functor?

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,
+7
functor composition haskell category-theory applicative
source share
2 answers

This is not a covariant functor

 fx = x -> r 

but f . f f . f is an "extension" of a functor (also a monad):

 f (fx) = (x -> r) -> r 

This is probably not a good example, because f is a contravariant functor.

+8
source share

Let g :: *->* . Then Const A . g Const A . g is a functor for any A , which is actually isomorphic to Const A

+7
source share

All Articles