I found my experience trying to work with a large OCaml base a nightmare — when signatures changed in an unstable dependency (e.g. function argument removed and nested inside another), the errors spat out by the typechecker were utterly incomphrehensible. This was largely due to automatic currying in OCaml — if I have a function call "some_function arg1 arg2" and "some_function" adds a third argument, that call becom…
Forgive my ignorance, I'd would like an example of the "functional" (hehe) benefits of automatic currying
Automatic currying is syntactic sugar that can make these two easier and clearer as it gets rid of a bunch of named arguments and lambdas. For example, I can write:
foo a b c = a * b + c
I can then apply this partially like this (foo2 just takes argument c): foo2 = foo 10 20
and compose it with other functions, for example like this: composed = foo2 >> bar >> baz
Without currying, you'd have something like: foo (a, b, c) = a * b + c
foo2 (z) = foo (10, 20, z)
composed (a) = (\b -> foo2 (b)) ((\c -> bar (c)) (baz (a)))