-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
write "getting started" guide #210
Comments
After reading the summary/introduction, the full picture of where Sanctuary extends beyond Ramda is not entirely clear. Does it add new functions or just replace existing Ramda functions with type safe versions? |
Earlier today @dypsilon described Sanctuary as "a Ramda reboot". I had not thought of it this way, but it's an accurate description. The two libraries have a great deal in common philosophically. Points of agreement:
The two libraries differ philosophically in a few significant ways. Points of disagreement:
Let's consider the points of difference. Ramda provides some variadic functions (such as S.lift2 :: Apply f => (a -> b -> c) -> f a -> f b -> f c With R.lift :: (*... -> *) -> ([*]... -> [*]) Ramda has many partial functions, such as Ramda and Sanctuary disagree on whether On this last point, @buzzdecafe has said that he believes run-time type checking would benefit Ramda. It's possible Ramda and Sanctuary will reconcile this difference. :) |
I was primarily talking about Ramda and Sanctuary in the context of working with types. I think Ramda does a great job of working with native data types. You could just drop Ramda in any project and have a great time working with those arrays and strings in a somewhat functional way. On the other hand, Ramda is awkward for working with algebraic types as defined in Fantasy Land. This is the reason why there are so many libraries which redefine simple functions, already included in Ramda, for working with algebraic types. My suggestion was to stop complicating Ramda with algebraic type classes and leave it to Sanctuary. Especially because the former doesn't have any type checking on board. |
@davidchambers i am coming around. my major problems with run-time type-checking are
But the benefits are clear, and I don't dispute that something is better than nothing. |
I don't see it this way. I quite happily use
I consider transducers the most significant source of complexity in Ramda's implementation. Having |
i see the placeholder as the biggest offender. I agree that transducers add complexity, but they also pay off. The placeholder adds overhead to the most fundamental operation in the libarry and delivers nothing that you can't get with |
I agree. Cost–benefit analysis is important. I believe the benefit of |
Yes, me too. The intent was to provide a point-free interface for FL types and look more ML-ish. I'm curious exactly what @dypsilon finds awkward? |
Perhaps it's time for Ramda to consider how to pull Transducers into a side package such as Fantasy and Lenses.
I'm not sure I go as far as that. There all sorts of things that could be done with, say, |
Here is a very simple comparison between Ramda/Sanctuary function names. It is at least helpful for me to visualize some of the differences b/w the two libraries, so thought I would share: |
That's a useful document, @thurt! Keep in mind that the shared functions are in same cases equivalent when used correctly (e.g. |
True--comparing just by function name is like comparing apples-to-oranges in some cases. It looks like the |
I would appreciate an example definition of a custom type class. Also #390 looks like a duplicate (or at least related). |
Are the definitions of |
@davidchambers This is certainly helpful. In my opinion a perfect example would include:
|
That's a good outline, @futpib. Would you like to take the lead on this? I'm happy to provide feedback. If you're interested, you could open a pull request to this repository containing a single Markdown file, we could get feedback from the community and make changes, then copy the final version and paste it into the wiki. |
Hey, are there any news to this ? |
There's no update yet, @Fl4m3Ph03n1x. Sorry. I ran a two-hour workshop at LambdaConf last month. It was recorded, and the recording will at some point be uploaded to YouTube. I'll share a link here once that has happened.
What would you like to know? Why one might use Sanctuary, or how to install and configure it, or how to use it, or some combination of these, or something else entirely? |
Ah yes, the workshop would be great!
Now, I feel I am missing the following:
IMHO, code sample of small projects ( like reading from a file using Node.js To this end, small demo projects ( which are usually presented at conferences ) are a great help, at least for me, and I really wish there were more. As a side way, it would also be interesting to add a section of "relevant articles" that others made to help ease people into Sanctuary and to provide them with additional documentation. |
Thank you for your thoughtful response, @Fl4m3Ph03n1x. I find it very helpful indeed.
I sympathize. Sanctuary has many moving parts and it's not obvious how one should fit them together.
I'm not sure what you mean by this. Do you mean that Sanctuary contains many functions for working with values of types
This is another excellent suggestion. :) |
What I mean by this is that Compared to, for example, Folktale, which has about 2 methods for their Maybe and Either ( Result ) types ( It is not to say that this is a bad thing, it's just that as a newcomer, I would be more inclined towards Folktale because I feel the learning curve would be smaller while retaining the same benefits Sanctuary offers. |
This may be a clearer example for const { unsafeGetUser } = require ('some-external-dependency');
// getUser :: Integer -> Maybe User
const getUser = S.encase (unsafeGetUser); We've defined a pure function in terms of an impure function. :) Your comments about the daunting API are well taken. The remedy, I believe, is not to remove functions but to provide tutorials so that new users are not forced to read what is essentially reference material. |
@davidchambers I would argue that separate :: (Filterable f, Functor f) => f (Either a b) -> Pair (f a) (f b) or separate :: (Filterable f, Functor f) => f (Either a b) -> { lefts :: f a, rights :: f b } |
Please open an issue for that proposal, Gabe. :) |
Is there a way I could help to contribute to this guide? |
That would be wonderful! Would you like to contribute to the wiki? If so I will create a new wiki entry. To encourage participation from me and others, I suggest publishing something and requesting input. :) |
As suggested by @riston on Gitter.
The text was updated successfully, but these errors were encountered: