[Haskell-cafe] Is this a "monad" for contravariant functors?

Zemyla zemyla at gmail.com
Fri Mar 10 22:25:12 UTC 2017

There originally seems like there shouldn't be one, because it's impossible
to, for any permutation of the arguments of (>>=), get the
covariances/contravariances right on the arguments. However, based on the
fact that there is a mapping:

a -> ((a -> r) -> r)

and what seems like an isomorphism:

(a -> r) -> (((a -> r) -> r) -> r)
(((a -> r) -> r) -> r) -> (a -> r)

then this looks like it might be some kind of monad-like structure:

class Contravariant f => Contramonad f where
    contrareturn :: a -> f (f a)
    contrabind :: (a -> f (f b)) -> f b -> f a

I have no idea what the laws should be for it, though. So is this worth
pursuing, or have I just stumbled down a blind alley?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170310/9d81d9b5/attachment-0001.html>

More information about the Haskell-Cafe mailing list