-
*Install a CPython distribution.
If you're already a user of CPython, you can skip this step.
Otherwise, go to this official download page, download and install any valid distribution(
>=3.5, <=3.8). -
Install nodejs, which is distributed with a command
npm, and usenpmto installpurescriptand its package managerspago. The latest version of the purescript compiler that is supported is 0.13.8:npm install -g purescript npm install -g spago
You might check PureScript: Getting Started for more details.
-
Install PureScript-Python components:
curl -fsSL https://raw.githubusercontent.com/purescript-python/installer/master/install.sh | bash -
Create an empty folder called
hello-worldsomewhere appropriate,get in, and callspago init # init purescript project pspy --init # init purescript-python local configuration -
Add a key
backendwith value"pspy", to filespago.dhallof yourhello-worldproject. This is an example:{- Welcome to a Spago project! You can edit this file as you like. -} { name = "my-project" , dependencies = [ "console", "effect", "psci-support" ] , packages = ./packages.dhall , sources = [ "src/**/*.purs", "test/**/*.purs" ] , backend = "pspy" -- !!NOTE THIS!! }
-
Write your code in
src/**.purs, and usespago runto execute your project(the default entry module isMain).
PureScript is close to Haskell, hence a Haskell user can pick it up in few seconds.
The home of PureScript is PureScript.org, where you can find things involving documentations.
A major motivation for my working on PureScript is its lightweighted but awesome IDE support.
For VSCode users, installing the plugin PureScript IDE and File -> Preferences -> Settings -> (search purescript) -> Turn on "Add Spago sources" will be sufficient. No need to install some GitHub repo and build for 4 hours! And this IDE feels swift!
If pspy-blueprint provided by the Python package purescripto didn't work(e.g., users of MacOSX < 10.15), you should manually install it from this repository, and currently there're 2 options:
- Install from GitHub release page.
- Install from source(Need Haskell stack): clone this repo, and use command
stack install ., which will installpspy-blueprintto your.localPATH.
For Linux users, you might also need to use chmod u+x <path/to/pspy-blueprint> to allow the permission to execute.
This seems to be a recent issue produced by the upstream compiler, and you can resolve this by removing the current output directory:
rm -rf $YOUR_PROJECT_ROOT/output && spago build && pspy --runThis will produce the result of your latest code.