Function Currying in Elm

While learning Elm I came across concept common in functional programming called Currying, where you partially execute some function and return a function that composes the first one.

Here is an example in Elm:

Let’s write a function that divides 2 numbers and returns difference as a string:

divideNumbers: Float -> Float -> String
divideNumbers divisor dividend = 
  dividend / divisor
    |> toString

Now lets say there we want to make a function that always divides by 2 (divisor = 2). We can create a new function using divideNumber fn:

divideBy2: Float -> String
divideBy2 =
  divideNumbers 2

Currying should not be confused with composition. To quote reply form stackoverflow:

Currying is a way of constructing functions that allows partial application of a function’s arguments.

Compose should return a function that is the composition of a list of functions of arbitrary length. Each function is called on the return value of the function that follows.