Quantcast

Is this a "monad" for contravariant functors?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Is this a "monad" for contravariant functors?

Zemyla
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?

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is this a "monad" for contravariant functors?

migmit-2
Answered it here: http://stackoverflow.com/questions/30641500/are-there-contravariant-monads/30642831#30642831

> On 10 Mar 2017, at 23:25, Zemyla <[hidden email]> wrote:
>
> 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?
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Loading...