Currying: Elixir library to add currying capability to all your Elixir functions

Given that this is just part of your larger effort I think you need to stick with what you have - it’s just that there is going to be an “impedance mismatch” with functions originating from the outside of your library as they are going to apply different criteria for the ordering of their function parameters (including possibly default parameters).

I was talking more about the usefulness of curried functions in isolation, in an environment that doesn’t default to it. In Haskell curried functions seem to be a result of a focus on single parameter functions, i.e. functions that compose easily; curried functions in essence seem to supply a mechanism that allows functions to be “configured” one-parameter-at-time via partial application until they can become part of a function composition (ultimately driving towards the Pointfree style).

So given the process of curried functions being the first step towards function composition I would expect in Elixir “the spirit of currying” to drive toward a pattern like

result = data_struct |> fn1pa |> fn2pa |> fn3pa

which may be useful when the functions in the composition aren’t “configured” (partially applied) inside the current function’s closure.

But within the context of your larger library the goals seem to be entirely different.

1 Like