Here’s the translated code from Go to PureScript, along with explanations in Markdown format suitable for Hugo:
In PureScript, variables are explicitly declared and used by the compiler to check type-correctness of function calls.
To run this program, you would typically use the PureScript compiler (purs) and Node.js:
In PureScript:
Variables are declared using let within a do block or at the top level of a module.
Multiple variables can be declared in a single let block.
Type inference is used, but you can also explicitly specify types.
There’s no concept of “zero values” like in some other languages. Instead, you might use the Maybe type to represent potentially absent values.
All bindings in PureScript are immutable by default, so there’s no equivalent to the := syntax for reassignment.
Functions like print or println are replaced with log from the Effect.Console module.
PureScript is a strongly-typed, purely functional language, so it handles variables and state differently from imperative languages. The focus is on immutability and explicit handling of side effects.