adjunctions
adjunctions copied to clipboard
Remove cotraverse1 and distribute1 methods
-
The
cotraverse
anddistribute1
methods were incompatible withGeneralizedNewtypeDeriving
. Remove them, leavingcollect1
andcotraverseMap1
. Use GND to derive theRepresentable
instance forCo
, which bakes in a test that this remains possible. -
Add an optimized version of
cotraverseMap1Iso
for the case where the isomorphism is a coercion. Also, require less polymorphism in one argument ofcotraverseMap1Iso
. -
Add a
MonadFix
instance forCo
. -
Make the
Functor
instance forCo
use theRepresentable
instance. -
Flesh out more class methods for
Co
(for example,<*
,*>
, and<$
admit particularly simple and efficient definitions).
Fixes #62
@aaronvargo, I would appreciate your input on this. Also: I'm not totally convinced that we win anything by making collect1
a class method rather than just a function. Do you know of a case where we do? If not, I'd be very tempted to remove it for now.
Please DO NOT SQUASH. I've broken this PR into one commit that creates Data.Functor.Rep.Internal
and a separate one that actually makes substantive changes.
What's the right way to fix things so git recognizes that first thing as a move? I don't want to get all the git blame
for the whole module.
One potentially controversial point: the new Functor
instance for Co
will be bad if the Representable
instance doesn't define cotraverseMap1
.
(But I think that's okay; Co
is presumably mostly for DerivingVia
, and people are free not to use it if they don't want it.)