fantasyland / fantasy-land

Specification for interoperability of common algebraic structures in JavaScript
MIT License
10.13k stars 376 forks source link

Profunctor should require Contravariant #331

Open Ne4to777 opened 3 years ago

Ne4to777 commented 3 years ago

I think it should be something like this: image

davidchambers commented 3 years ago

The diagram in the readme indicates the dependencies that exist between algebra in the specification. Your diagram suggests we should add new dependencies to the specification. Please explain why this would be beneficial.

Ne4to777 commented 3 years ago

The diagram in the readme indicates the dependencies that exist between algebra in the specification

No, it is not. 1) А Functor does not exist on its own. It can only be covariant or contravariant. Therefore, the Functor and Contravariant are entities of different order. 2) Profunctor must implements both Covariant and Contravariant at the same time

CrossEye commented 3 years ago

@Ne4to777:

You realize that this is open source, right? You're free to fork it and change your fork as you will, or to create your own. You are also free to create your own specification from scratch. If you feel strongly about it, you can then try to convince all those implementing these specs that your own are better and that they should switch.

While you're at it, you should probably edit the Wikipedia page on Functors to match your definition and convince the maintainers of languages such as Haskell, Scala, and Clojure to change their specifications to match.







Alternatively, you can simply stop trolling.

puffnfresh commented 3 years ago

The Fantasy Land Functor is short for "Covariant Functor"

Profunctor is super useful and I don't think it's specified, that's the only difference to the diagram that I can see.

davidchambers commented 3 years ago

Profunctor is super useful and I don't think it's specified, that's the only difference to the diagram that I can see.

Actually, Profunctor is specified. :tada:

Profunctor must implements both Covariant and Contravariant at the same time

Profunctor currently requires Functor but not Contravariant.

@Ne4to777, please explain why Profunctor should require Contravariant in addition to Functor. We will certainly consider changing the specification if presented with a compelling reason to do so. :)

Ne4to777 commented 3 years ago

Alternatively, you can simply stop trolling.

@CrossEye , Who else is trolling?)

Ne4to777 commented 3 years ago

The Fantasy Land Functor is short for "Covariant Functor"

This is the question why the derivatives of a covariant functor cannot be derivatives of a contravariant functor? For example contravariant monads.

Profunctor is super useful and I don't think it's specified, that's the only difference to the diagram that I can see.

and it implements the contravariant functor with the second argument

Ne4to777 commented 3 years ago

@Ne4to777, please explain why Profunctor should require Contravariant in addition to Functor. We will certainly consider changing the specification if presented with a compelling reason to do so. :)

because: 1) nothing prevents derivatives (like Chain or Monad) from being used together with a contravariant functor 2) The profunctor implements a contravariant functor as its second argument

davidchambers commented 3 years ago

I have updated this issue's title to reflect the change @Ne4to777 is proposing.

@fantasyland/core, what do you think of the proposal?

Ne4to777 commented 3 years ago

@davidchambers , aliasing Covariant to Functor is a bad idea too. Especially since we already have an abstract entity - a monad