Tutorial by Examples

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...
Returning partially applied functions is one technique to write concise code. add :: Int -> Int -> Int add x = (+x) add 5 2 In this example (+x) is a partially applied function. Notice that the second parameter to the add function does not need to be specified in the function definitio...
Sectioning is a concise way to partially apply arguments to infix operators. For example, if we want to write a function which adds "ing" to the end of a word we can use a section to succinctly define a function. > (++ "ing") "laugh" "laughing" Notice...

Page 1 of 1