<div dir="ltr">Actually it is trickier than you'd think.<div><br></div><div>With "Functor" you can pretend that contravariance doesn't exist.</div><div><br></div><div>With both profunctor and contravariant it is necessarily part of the puzzle.</div><div><br></div><div>data Compose f g a = Compose (f (g a))</div><div><br></div><div>* are both f and g contravariant leading to a functor?</div><div>* is f contravariant and g covariant leading to a contravariant functor?</div><div>* is f covariant and g contravariant leading to a contravariant functor?</div><div><br></div><div>data Wat p f a b = Wat (p (f a) b)</div><div><br></div><div>is p a Profunctor or a Bifunctor? is f Contravariant or a Functor?</div><div><br></div><div>We investigated adding TH code-generation for the contravariant package, and ultimately rejected it on these grounds.<br><br><a href="https://github.com/ekmett/contravariant/issues/17">https://github.com/ekmett/contravariant/issues/17</a><br></div><div><br></div><div>-Edward</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 11, 2015 at 12:49 PM, David Feuer <span dir="ltr"><<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Would it be possible to add mechanisms to derive Contravariant and<br>
Profunctor instances? As with Functor, each algebraic datatype can<br>
only have one sensible instance of each of these.<br>
<span class="HOEnZb"><font color="#888888"><br>
David Feuer<br>
_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</font></span></blockquote></div><br></div>