Open davidchambers opened 7 years ago
Go go go π
:herb:
I'd just like to say thanks to the contributors for having done this in the first place - I found the ramda-fantasy implementations, and especially the documentation, a great help in understanding some of the different ADTs. (I also miss its presence from the Ramda REPL!)
@davidchambers Could you share links of possible libraries one should use for new projects?
Here are the proposed alternatives:
β Currently only available as part of Sanctuary.
All PRs other than #131 have been merged. I'll go ahead and release 0.8
shortly.
0.8.0
has been released. #131 can now be updated.
Thanks @scott-christopher !
Until sanctuary-maybe and sanctuary-either are available, what should I use for new projects? I prefer ramda over sanctuary .. I would rather not install sanctuary just to have Maybe & Either ..
Any thoughts on that?
you can keep using RF, but it will not be getting further upgrades (unless someone else takes it up); or you can try folktale as well:
Just to mention folktale-2.0.0 (http://folktale.origamitower.com/) released on 2017-07-11 has breaking changes in its API:
Maybe http://folktale.origamitower.com/docs/v2.0.0/migrating/from-data.maybe/ doc: http://folktale.origamitower.com/api/v2.0.0/en/folktale.maybe.html
Either Either[Left, Right] is replaced by Result[Error, OK] http://folktale.origamitower.com/docs/v2.0.0/migrating/from-data.either/ doc : http://folktale.origamitower.com/api/v2.0.0/en/folktale.result.html
Both are "stable" in their stability index.
HI guys, just wanted to mention this library that seems to do a whole lot of fp stuff but barely anyone notices: urbandrone/futils it even has transducers and trampolining. let me know what you think.
@niksosf thanks for the heads up, i'll keep an eye on it
Seems there is no a consistent library to use for FP. The recommended replacements require the installation of an entire library to just use a couple of types. Seems that we should cherry-pick the best implementation of each library, which seems like a total waste of time and resources to my eye. I think it would be better to take one approach or the other: provide a single library with all the required stuff or to split every function and type into a separate library. To be honest, I'm a bit confused about which toolset of FP libraries to choose.
Regards
@danielo515: Please note several things
The libraries that exist are there to serve certain purposes. Ramda is all about working with existing types. Its functions support some subset of lists (arrays, really), objects, functions, numbers, and strings. It delegates many of its functions to your type, especially those that match FantasyLand specs. But Ramda isn't in the business of supplying types of its own. Sanctuary is similar, except that its API requires Maybe
and Either
outputs, so it supplies them. Libraries like Folktale, on the other hand, are mostly about creating types for you, and they don't supply the wide variety of functions on existing types offered by Ramda and Sanctuary. See also a StackOverflow answer that goes into more depth on this.
I don't know about all the libraries suggested above. I tend to use Folktale for my needs, as it has a large collection of useful types, all well designed and well implemented. With Folktale you can choose the types you like. Why would you feel the need to include the Reader Monad when all you want is Task and Maybe? I usually only use a handful of its types in any one project.
I think it would be better to take one approach or the other: provide a single library with all the required stuff or to split every function and type into a separate library.
FP is huge. It encompasses a handful of key ideas, and a huge number of implementations of them. There is no way to gather them all together. If you want to see something of the scale, start scanning the Haskell docs. There is simply no way to get all that ported into a single JS library. As to the individual functions, you can use Ramda that way, and Folktale too, and probably others. If that's what you choose, it's available.
I'm a bit confused about which toolset of FP libraries to choose.
Of course it depends upon what you want to do. But my suggestion would be to start with Ramda; if it doesn't seem strict enough to you, try Sanctuary instead. And if you need a Maybe
or a Future
, look at Folktale or the built-in FantasyLand ones. But only add individual types as you need them. There is no Monoid or Functor type, only concrete types which implement those specifications. But there is an unlimited number of them possible. So find the ones you need and include them.
Thanks for your suggestions. I think that as long as the types implements the fantasyland specification and the functions can understand them I'll be fine. However libraries like folktale seems to be on it's own way. Am I right? You are also mentioning to only import certain types, do you mean tree shaking ?
You can require or import Ramda functions individually:
const map = require('ramda/src/map')
Or you could probably use some tree-shaking code against the whole Ramda export.
For Folktale, as far as I know, they still support the FantasyLand specifications..
Over the past few days I have published these packages:
Descending a
Either a b
Identity a
Maybe a
Pair a b
The Ramda team has decided that this library is no longer serving the JavaScript FP community well. It has not kept up with changes to the Fantasy Land spec, and many of the data types lack useful features available in other libraries.
The consensus among the Fantasy Land team is that the proliferation of implementations of the same handful of algebraic data types is a trend which should be reversed. The more implementations of an ADT exist, the more unlawful implementations are likely to exist. Furthermore, it's impractical to mix and match implementations, resulting in functions such as this:
There are, though, a number of people using ramda-fantasy. We wish to wind down this project without affecting these users, so of course the npm releases will remain available indefinitely. Furthermore, @scott-christopher has suggested merging some of the open pull requests and making one final release. I think this is an excellent idea.
In fact, I suggest going one step further. What do people think of this approach?
/cc @SimonRichardson