Elm Language Functions and Partial Application Partial Application


Partial application means calling a function with less arguments than it has and saving the result as another function (that waits for the rest of the arguments).

multiplyBy: Int -> Int -> Int    
multiplyBy x y =
    x * y

multiplyByTwo : Int -> Int  -- one Int has disappeared! we now know what x is.
multiplyByTwo =
    multiplyBy 2

> multiplyByTwo 2
4 : Int

> multiplyByTwo 4
8 : Int

As an academic sidenote, Elm can do this because of currying behind the scenes.