Title here
Summary here
Functions are central in PureScript. We’ll learn about functions with a few different examples.
Here’s a function that takes two Int
s and returns their sum as an Int
.
PureScript uses implicit returns, so the last expression in a function is automatically returned.
When you have multiple parameters, you can define them separately or use currying, which is more idiomatic in PureScript.
Call a function just as you’d expect, with name args
.
To run the program, you would typically use the PureScript compiler (purs
) and Node.js:
There are several other features to PureScript functions. One is currying, which we’ve implicitly used in our examples above.