Currying and Uncurrying
Learn how to transform functions into their curried or uncurried forms.
We'll cover the following...
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) -> BoolisTriangleTuple (alpha, beta, gamma) = alpha + beta + gamma == 180main = print (isTriangleTuple (90, 45, 45))
we also can turn it into its curried form:
Press + to interact
isTriangle :: Double -> Double -> Double -> BoolisTriangle alpha beta gamma = alpha + beta + gamma == 180main = print (isTriangle 90 50 50)
and we can use a partial application with one or two arguments.
mustBeSixty = isTriangle
...