|
|
|
|
|
by ufo
4155 days ago
|
|
One situation where I felt compelled to use lots of currying was when I was working with a promise library for async code. There are lots of little callbacks you need to use and you benefit from having combinators that act as function versions of js operators, like "+", "[]" and so on and currying helps cut down on the number of combinators you need. That said, I didn't end up being a big fan of it in the end. Other people can get confused by the new abstractions the combinators introduce and whenever you pass the wrong number of arguments to a function you end up with very tricky runtime errors (this isn't an issue in Haskell because the type system checks this for you) |
|
Would mind posting an example?
(I was wondering what something like Flow.js would make of the code. i.e. Could it make catching those errors easier)
Cheers.