- No runtime system beyond some support types and functions
- Uses PureScript's normal tail call optimization techniques for generated Go code
- Foreign imports/exports are Go instead of JavaScript – see standard library foreign implementations
- No Go-specific REPL
-
The provided
Any
type is just an alias forinterface{}
-
PureScript types are represented in Go with:
PureScript Go Array
[]Any
String
string
Number
float64
Int
int
Char
string
(single UTF-8 entity)Boolean
bool
Records map[string]Any
- Nice facilities (modules) for concurrency/parallelism, using goroutines
This assumes you are running macOS (OS X) or a Unix-like system (Linux, *BSD, etc.).
-
Choose a working directory wherever you like. Then create a
src
subdirectory under it, which will be where you will place your own PureScript source files. -
Initialize your project with
spago init
, and install any dependencies withspago install
(please see their instructions if you haven't used it before). -
Add the
backend = "psgo"
option to yourspago.dhall
file. That wayspago
will use the psgo backend when compiling. -
You should now be ready to build a PureScript program:
-
As stated above, place your source file(s) in the working directory's
src
subdirectory and executespago build
. -
This will generate the Go source tree for your program and then build an executable binary. The resulting executable will be in your working directory and will be named
Main
. The generated source files will be underoutput/
.