Comments (12)
Thanks! It'll be interesting to see what others think about the changes. I find it much harder to read without the names of the algebras and laws (something which was asked for).
But I'm obviously biased since I wrote most of it.
from fantasy-land.
I think it would be worth naming the laws. I'll add those in in a second. It would be useful when writing test suites if nothing else.
I think naming the objects is nice, but I think it should be at the end of the description of the method, rather than at the top level. Consider that most of your intended audience is much more familiar with JavaScript than Category Theory. Keep in mind that .map
and .concat
behave exactly like they do currently on arrays, which will make them feel instantly intuitive when labelled like that. .of
also behaves exactly like .of
will in ES6 if it makes it I think (needs checking, and this spec will need to pick another name if that's not true).
I think empty
may be better as a name than zero
if it doesn't conflict with anything that already exists. An empty
array makes intuitive sense for example.
I think .chain
may not be the most intuitive name either. I'd consider .flatten
which seems very nice for arrays, and not totally un-intuitive for promises. Unfortunately .then
would be pretty un-intuitive for arrays, but I guess it's not the end of the world.
from fantasy-land.
I've added in comments to link back to functional programming. Hopefully this is now approachable for people from both directions.
from fantasy-land.
+1 for empty
. This makes sense to me thinking in terms of data structures rather than numeric values. It's not as pure algebraically, but it's a bit more concrete.
@ForbesLindesay see #2 for a lengthy discussion about .chain
Overall, @ForbesLindesay, great work - seems very approachable.
from fantasy-land.
@jden I wanted to use empty
but was afraid it would already be in use. Don't think so?
from fantasy-land.
I'm not aware of any current uses. At least not in core EcmaScript or node.js
from fantasy-land.
I think empty
is safe. No mention of it on MDN, only _.isEmpty
in lodash/underscore comes to mind.
from fantasy-land.
Awesome, if I have no objections by the end of today then I'll use it.
from fantasy-land.
Ping re empty
^
from fantasy-land.
+1 for empty
. Using zero
would be misleading in some contexts (e.g., Product)
from fantasy-land.
Reference: 2091648
from fantasy-land.
This issue is still showing up on my personal "open issues mentioning you" list, limiting its utility. Could you please consider closing it?
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
- should Chain properties depends on fantasy-land/ap (and possibly .map)? HOT 4
- 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.