-
Notifications
You must be signed in to change notification settings - Fork 9
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
Flip andThen parameters for better currying [breaking change] #11
Comments
Ramda also takes this approach:
|
I don't really see any benefit in doing this, since JavaScript does not support currying or the pipeline operator. I'd love to hear an argument on this though. |
I am aware that this change doesn't give much advantage when it comes to currying or pipelining because JavaScript doesn't support this (yet?). |
I don't use this library anymore, closing after no response for a few months. |
Sorry for the radio silence, work has been keeping me super busy. I've actually been thinking about this quite a bit, and I have a little regret with the way I designed this library. I tried to make the API as close to Elm's as possible, and I think I should have embraced the OO part of JavaScript more. decoder.map(fn)
decoder.andThen(fn) I think this fits better into the JavaScript/TypeScript world, and I could get rid of a weird hack in the source code that I had to make in order to allow "package private functions". Any thoughts? |
This is a conflict I've been struggeling with, too. For my current project and for my JSON decoder I just used functions everywhere, just like Ramda. The advantage is that I can discard all the strange OO-stuff in JavaScript and just work with functions and values. The problem with this approach is that you can't really hide implementation details, because TypeScript doesn't have features like opaque types. I think both approaches are valid in the current JavaScript landscape and your suggestion looks reasonable to me. |
Right now, the signature of
andThen
isChanging the order of the parameters to
would adhere to the idea that you first pass configuration into the function, and later the data the function operates on.
Elm also did this change in 0.18: https://github.com/elm-lang/elm-platform/blob/master/upgrade-docs/0.18.md#backticks-and-andthen
The text was updated successfully, but these errors were encountered: