Skip to content

MeetLambda/purescript_first_steps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 [email protected]
> npm install -g [email protected]

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