Compiling the purescript
code, supposing nvm
is already installed, is as simple as typing:
> nvm install --lts (12.16.0)
> npm install -g [email protected]
> npm install -g [email protected]
To support editing Purescript files, there are two useful VSCode plugins:
- PureScript IDE: https://github.com/nwolverson/vscode-ide-purescript
- PureScript Language Support: https://github.com/nwolverson/vscode-language-purescript
In order to have errors highlighted directly into VSCode, you need to set one option into the "PureScript IDE" module:
- "purescript.editorMode": true (Editor Mode: Whether to set the editor-mode flag on the IDE server)
To build the application, type in the terminal windows:
spago build
To run the application, type in the terminal windows:
spago run
To keep building the application when a file is saved, use the following command:
spago build --watch --clear-screen
To check the other options available when using spago
, check its documentation
A docker container with Spago and Purescript is available on docker hub public repository at gior/purescriptwithspago. thanks to Giorgia Rondinini
To interface VSCode with the container, install "Remote Development" extension, available at https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack
There are two ways to use this container for developement :
-
Let VSCode build the container for you when you open the purescript_first_steps folder from the IDE.
-
Download the container from docker hub, run it and attach to running container from VSCode:
docker run -ti gior/purescriptwithspago bash
This environment works on Windows and Mac (with Docker Desktop), and Linux
Links to resources referenced during MeetLambda meetings
Basic language reference : https://github.com/purescript/documentation/tree/master/language
Extensive language documentation : https://pursuit.purescript.org/
Book used to translate examples from Haskell to Purescript : https://leanpub.com/finding-success-in-haskell
Standard type classes in Haskell, referenced for analogy with Purescript : https://wiki.haskell.org/wikiupload/e/e9/Typeclassopedia.pdf