...

/

Currying and Uncurrying

Currying and Uncurrying

Learn how to transform functions into their curried or uncurried forms.

Currying functions with more arguments

The technique of currying is not limited to functions with two arguments. If we have a function with three arguments like this:

Press + to interact
isTriangleTuple :: (Double, Double, Double) -> Bool
isTriangleTuple (alpha, beta, gamma) = alpha + beta + gamma == 180
main = print (isTriangleTuple (90, 45, 45))

we also can turn it into its curried form:

Press + to interact
isTriangle :: Double -> Double -> Double -> Bool
isTriangle alpha beta gamma = alpha + beta + gamma == 180
main = print (isTriangle 90 50 50)

and we can use a partial application with one or two arguments.

mustBeSixty = isTriangle
...