<div dir="ltr">I'd be open to merging the existing Data.Functor.Contravariant module into base (inverting dependencies as needed), while leaving the remainder of the contravariant package intact. This module contains the class and a couple of example contravariant functors, much in the same vein as Data.Monoid. This would leave the more exotic machinery for 'contravariant applicatives' and all the generic programming bits in the package.<div><br></div><div><div>+1</div></div><div><br></div><div>This would be similar to the migration of Data.Proxy from tagged into base, which left behind Data.Tagged or the migration of Data.Semigroup from semigroups, which left behind the generics module.<div><div><br></div></div><div>Almost all of the dependencies that would have inversions are packages I maintain personally. The only package that would require coordination with another maintainer would be inverting the instances for data types supplied by transformers.<div><div><br></div><div>If there was a sufficient call for it, I'd be open to moving the rest into base, but I don't anticipate a great deal of demand and this could always happen at a later date or as part of another proposal, should this change.</div><div><br></div><div>-Edward</div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 12, 2017 at 11:44 PM, Daniel Díaz Casanueva <span dir="ltr"><<a href="mailto:dhelta.diaz@gmail.com" target="_blank">dhelta.diaz@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear haskellers,<div><br></div><div>I admit I might not have the strongest arguments here, but I thought that I would share my opinion anyway, and maybe get other people's perspectives. I would like to propose bringing the Contravariant class [1] to base.</div><div><br></div><div>I know, base keeps growing, and maybe there is no need for it to grow further without a strong argument, but I do feel like Contravariant is a simple, very basic class, that would receive better and greater use if included in base. Contravariant is very similar to Functor (some people call it CoFunctor), but in `contramap` (Contravariant's `fmap`) the "arrow" of the applied function goes in the opposite direction. I think that `contramap` can be useful for many types, just like `fmap` is for many others, but we don't use it because it's not yet so popular, or maybe because it requires the contravariant package to be included as dependency (although personally I don't think that is a real problem). The contravariant package itself provides a plentiful of instances, many of them for types in base.</div><div><br></div><div>In a real world scenario I had, it was very useful to add a Contravariant instance to `Data.Aeson.ToJSONKeyFunction`<wbr>, that perhaps is not included in aeson because either it was not desired to add the contravariant package as dependency, or simply because Contravariant is not so well-known. Note that, however, `FromJSONKeyFunction` _is_ instance of Functor. Even though both instances are equally natural and useful in this context, only one of them was implemented. This probably would not have happened if Contravariant was in base.</div><div><br></div><div>So, in my opinion, for the sake of completeness, I think we should add Contravariant to base, just as we have Functor. Note that my proposal does not necessarily include the rest of types and functions defined in the contravariant package.</div><div><br></div><div>Best regards,</div><div>Daniel Casanueva</div><div><br></div><div># References</div><div><br></div><div>[1] <a href="http://hackage.haskell.org/package/contravariant-1.4/docs/Data-Functor-Contravariant.html#t:Contravariant" target="_blank">http://hackage.haskell.<wbr>org/package/contravariant-1.4/<wbr>docs/Data-Functor-<wbr>Contravariant.html#t:<wbr>Contravariant</a></div></div>
<br>______________________________<wbr>_________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/libraries</a><br>
<br></blockquote></div><br></div>