<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>It seems like very few people are changing their minds, after a lot of discussion -- maybe it's time to agree to disagree, in the form of a vote on whether to include the tuple instances.</div><div><br></div><div> If so, I'd think we'd want to come to the users with a discussion of both sides and a poll, a la FTP.</div><div><br></div><div>Tom</div><div><br></div><div><br>El 24 feb 2016, a las 11:38, David Feuer <<a href="mailto:david.feuer@gmail.com">david.feuer@gmail.com</a>> escribió:<br><br></div><blockquote type="cite"><div><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 24, 2016 at 11:22 AM, Kosyrev Serge <span dir="ltr"><<a href="mailto:_deepfire@feelingofgreen.ru" target="_blank">_deepfire@feelingofgreen.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Are you also saying that this cannot be resolved by some kind of a<br>
type families-based type-level 'flip'?<br>
<span class="im HOEnZb"></span></blockquote><div><br></div><div>It really can't, no. You can define<br><br></div><div>type family FlipF f a b where<br></div><div> FlipF f a b = f b a<br><br></div><div>but FlipF, being a type family, is not first-class. You can't make any instances whatsoever for FlipF f a -- you'll probably get an error about a partially applied type family. What you *can* do is make a Flip newtype:<br><br></div><div>newtype Flip f a b = Flip {unflip :: f b a}<br><br></div><div>This behaves perfectly:<br><br></div><div>instance Bifunctor f => Functor (Flip f a) where<br></div><div> fmap f = Flip . first f . unflip<br></div><div>instance Profunctor f => Contravariant (Flip f a) where<br></div><div> contramap f = Flip . lmap f . unflip<br></div><div>instance Bifunctor f => Bifunctor (Flip f) where<br></div><div> bimap f g (Flip x) = Flip (bimap g f x)<br></div></div></div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Libraries mailing list</span><br><span><a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a></span><br><span><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a></span><br></div></blockquote></body></html>