haskell - Are there contravariant monads? -


functors can covariant , contravariant. can covariant/contravariant duality applied monads?

something like:

class monad m   return :: -> m   (>>=) :: m -> (a -> m b) -> m b      class contramonad m   return :: -> m   contrabind :: m -> (b -> m a) -> m b 

does contramonad class make sense? examples?

well, of course, it's possible define it, doubt of use.

there popular saying "monad monoid in category of endofunctors". means is, first of all, have category of endofunctors (meaning, (covariant) functors category itself), , what's more, have multiplication on endofunctors (in case — composition). , monad fits general framework don't have worry right now. point is, there no "multiplication" of contravariant functors. composition of 2 covariant functors again covariant functor; composition of 2 contravariant functors not contravariant functor (rather it's covariant functor, so, totally different beast).

so, "contravariant monads" not make sense.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -