We can use partial application to "lock" the first argument. After applying one argument we are left with a function which expects one more argument before returning the result.
(+) :: Int -> Int -> Int
addOne :: Int -> Int
addOne = (+) 1
We can then use addOne
in order to add one to an Int
.
> addOne 5
6
> map addOne [1,2,3]
[2,3,4]