Skip to content

Latest commit

 

History

History
59 lines (34 loc) · 2.43 KB

File metadata and controls

59 lines (34 loc) · 2.43 KB

PureScript first steps

Initial setup and first build

Compiling the purescript code, supposing nvm is already installed, is as simple as typing:

> nvm install --lts (12.16.0)
> npm install -g purescript@0.13.6
> npm install -g spago@0.14.0

VSCode integration

To support editing Purescript files, there are two useful VSCode plugins:

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)

Running the code

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

Docker and VSCode Purescript Environment Setup

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 :

  1. Let VSCode build the container for you when you open the purescript_first_steps folder from the IDE.

  2. 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

Resources

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