Comments (4)
In my personal (contested) view it does, but not as explicitly. The dependency is captured in the Derivations section of the spec, where a relationship between ap
and chain
is described:
fantasy-land/ap may be derived from fantasy-land/chain:
function ap(m) { return m['fantasy-land/chain'](f => this['fantasy-land/map'](f)); }
I read this as: "A Chain must implement chain
such that ap
may be derived from it, and therefore every Chain has ap
(is an extension of Apply), and ap
must behave as if derived from chain
".
EDIT: Another way to think of it is that the Apply interface is like a weaker Chain interface: Apply can be defined in terms of Chain, but not the other way around. Since Apply is a weak Chain, Chain is an extended Apply. So we have the arrow Apply -> Chain
come out naturally.
from fantasy-land.
Well, the derivation section uses the "may" expression, not the "must". IMHO, an explicit property should be added to the fantasy-land/chain
method, which should enfasize the relationship between fantasy-land/ap
and fantasy-land/chain
(and, possibly, fantasy-land/map
). Otherwise, Chain should be placed at the same level of Functor
from fantasy-land.
I agree with you. I think the "may"-expression in the derivations section is a source of confusion. It's using "may" to suggest that a developer doesn't have to derive their implementation of ap
from their implementation of chain
, but "may" choose do so.
The reason they "may" choose to do so, is because it is assumed (but never explicitly stated) that this is always possible. I think the spec should be updated to make this more clear.
Furthermore, it is never made clear whether the non-derived implementation of ap
must behave in exactly the same way as the version derived from chain
would have, but in my view it should. This is the view that's contested (as far as I know, also in the broader FP community).
I've seen this discussion play out in other threads on this repo as well. A quick search came up with #214 but I think there might be more.
from fantasy-land.
I see. If I look through all the definitions I find other examples (traversable, for instance). Anyway, I'll follow your suggestion: I'll consider the derivation section mandatory. Thanks!
from fantasy-land.
Related Issues (20)
- [Question] Type signature for ap HOT 2
- Adding Folktale to implementations.md
- Equivalent for Serial typeclass? HOT 1
- Is really necessary specify "No parts of <...> value should be checked"? HOT 11
- Add Traversable1 HOT 3
- Help understanding use of identity in Traversable laws HOT 2
- Fantasy Land specification version number HOT 1
- Switch to Symbols HOT 2
- Wrong argument in Traversable HOT 4
- Is monet.js compatible? HOT 1
- Why FL specifies the ChainRec typeclass when there is the trampoline monad? HOT 7
- What does "and" mean? HOT 2
- Can someone explain me how I should understand Semigroup? HOT 5
- Remove all OOP features HOT 21
- Traversable and Foldable use multiple variables as arguments HOT 12
- Profunctor should require Contravariant HOT 10
- Implementation of `Compose` is confusing HOT 3
- Why putting "fantasy-land/" before everything in readme? HOT 3
- Is `Pair` a valid instance of `MonadRec`?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fantasy-land.