As a reader of that code cannot easily understand whether the number and type of arguments is correct, one has to rely on the type checker that everything will work out.
However, this is more of a criticism of ML syntax than of currying – all things are good in moderation.
As a practical consideration, this rarely if ever becomes an issue, and if it does, the type checker will tell you straight away.
Type annotations can make clear what isn't intuitively clear with a function's signature, and since the correctness of the type checker is rigorously proven, I don't see anything particularly wrong with "relying" on the type checker.
There is nothing wrong with relying on the type checker, except that it tends to add cognitive overhead.
It's very natural, and as Lisp/Scheme/Racket shows, it's perfectly fine in a dynamically typed context as well.
Bracha's critique, as usual, is missing the point.
For some reason it seems parent post would like to specifically indicate the case where a function application results in a value that is specifically not a function? Seem quite strange to me.
OTOH, pipeline operators make a good case for currying. There really is something nice about being able to write
sliceOfBread
|> smearWith peanut-butter
|> smearWith jelly
|> topWith sliceOfBread
|> cutInHalf
|> eat
instead of eat(cutInHalf(topWith(sliceOfBread, smearWith(jelly, smearWith(peanut-butter, sliceOfBread))))) infix |>;
fun x |> f = f x;
The definition is also similar in Haskell: x |> f = f x
And in OCaml: let (|>) x f = f x;;
F# and Elm provide this operator out of the box.http://thread.gmane.org/gmane.comp.lang.haskell.libraries/18...
I don't follow this. My understanding is that currying is pure syntactic sugar: it's a cheap way to expression partial application.
What am I missing?
So why complicate the language with native support for a feature whose encoding on top of one argument functions is concise, elegant, and works well?
I only know too well. Everytime I write stuff like
using std::placeholders;
std::bind(foo, bar, _1, _2, baz, _3, _4);
I wish I were using an applicative language instead.What about poison? Rabies? Rabies in moderation actually sounds quite appealing.