Search code examples
functionelmpartial-application

How to partially apply a function with desired order in Elm?


Suppose I have a function that takes 3 parameters as input. How to partially apply this function in Elm so it takes first and last parameters and waits for the second parameter to return the final result?

This can be done in Ramda with R.__ which is named placeholer.


Solution

  • You can just wrap it in a lambda function that has the shape you want, which is what would be produced by any other means anyway:

    \y -> f "x" y "z"
    

    In a curried language I find the need to do this so rare that adding syntax sugar specifically for this use case seems unnecessary.