Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require that Profunctor implement the Contravariant spec #252

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gabejohnson
Copy link
Member

Values which implement Bifunctor or Profunctor must also implement Functor.

Profunctor is covariant in the second argument and Bifunctor in both.

Since Profunctor is contravariant in the first argument, shouldn't a value implementing it also be required to implement Contravariant?

@gabejohnson
Copy link
Member Author

I realize the graph looks funky now. I'll try to fix that.

@davidchambers
Copy link
Member

This sounds completely reasonable to me. I'll defer to those with better understandings. :)

⚠️ This is a breaking change, so will warrant incrementing the major version number if merged.

@gabejohnson
Copy link
Member Author

gabejohnson commented Jun 9, 2017

@davidchambers I'm no longer sure that this is valid. I think (based on a comment by @puffnfresh on Gitter) that this reasoning works for Bifunctor and Profunctor WRT Functor because fixing the first argument results in a type that has a functor.

:k Bifunctor
Bifunctor :: (* -> * -> *) -> Constraint
 :k Functor
Functor :: (* -> *) -> Constraint

Now this isn't the case with Profunctor because it would be required to fix the second argument. Though honestly my type foo isn't sufficient to be certain.

@rjmk
Copy link
Contributor

rjmk commented Jun 12, 2017

It doesn't lead to inconsistency (though it breaks type inference), to allow type level lambdas like instance Contravariant (Λt -> t -> a) where ... (here the idea is to have the analogue to (->) a). It would quite a big change to the way Fantasy Land does things though

@davidchambers
Copy link
Member

What's the status of this pull request, @gabejohnson?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants