PureScript supports anonymous functions, which can form closures. Anonymous functions are useful when you want to define a function inline without having to name it.
To run this PureScript program, you would typically compile it and then run it using Node.js:
In PureScript, we use the Effect monad to handle side effects, which is why our intSeq function returns Effect (Effect Int) instead of just () -> Int. The inner Effect represents the side effect of incrementing and returning the counter.
The do notation is used for sequencing effectful computations, which is why we see it used in both intSeq and main.
The last feature of functions we’ll look at for now is recursion, which PureScript also supports.