The PureScript ecosystem contains a number of editor plugins and tools to help you build libraries and applications. The set of available tools is growing continuously, but this documentation contains popular, stable tools that you can use today.
At minimum, almost all projects will use:
- The PureScript compiler
- The Spago legacy build tool and package manager
- The Spago rewrite, a recent major rewrite of Spago package manager
These tools can be installed via NPM, among other installation methods.
At the moment of writing, Spago is going through a period of transition from an older to a new codebase. Consider the following characteristics of each:
Spago
- The currently maintained and actively developed version of Spago
- Considered to be in its alpha stage
Spago legacy
- Officially deprecated and not maintained, except for security updates
- Considered to be stable
- A lot of PureScript documentation and guides released pre-2024 would link to the
purescript/spago
repository while actually having Spago legacy and its API in mind - Most PureScript libraries and projects will be using this version for a while
Note that both versions are extensively documented in their respective repositories, consult these if you face any issues. Spago rewrite offers automatic ways of migration from Spago legacy-driven projects.
The PureScript compiler includes an IDE server, purs ide
, to supply tooling for editors. This server has been used to implement a PureScript language server, which implements the Language Server Protocol for PureScript. Major editor tooling either uses purs ide server
directly or via the language server.
Most editor plugins which rely on PureScript's IDE tooling have at least these features:
- Autocomplete (including auto-imports)
- Definitions and error reporting on hover
- Go-to-definition and local search
- REPL support
- Automatic builds
- Error suggestions and quick-fix actions for missing type signatures, imports, and more
- Case split and holes for type-driven development
Some tools are commonly used with several editors, as they are implemented to be editor-agnostic:
- psa is a pretty, flexible error/warning reporting frontend for the compiler featuring colours, original source spans in errors, warning filtering and persistence.
- pscid is a lightweight file-watcher and test runner which provides instant-rebuilds in an editor agnostic way.
To generate TAGS
files, use purs docs --format etags
(or --format ctags
).
- atom-language-purescript provides syntax highlighting for
.purs
files. - atom-ide-purescript provides editor support via
purs ide
.
- psc-ide-emacs provides editor support via
purs ide
. - purescript-mode provides syntax highlighting and indentation rules for
.purs
files. - psci-mode provides a minor mode for a PureScript REPL.
Spacemacs users can use the PureScript layer.
- PureScript plugin provides editor support via
purs ide
, syntax highlighting for.purs
files, and much more.
- purescript-ide-sublime provides editor support via
purs ide
and syntax highlighting for.purs
files.
- psc-ide-vim provides editor support via
purs ide
. - ale provides editor support via the PureScript language server.
- coc.nvim provides editor support via the PureScript language server.
- purescript-vim provides syntax highlighting and indentation rules for
.purs
files. - vim-lsp-settings provides automatic configuration for editor support via the PureScript language server
- ide-purescript provides editor support via the PureScript language server.
- language-purescript provides syntax highlighting for
.purs
files.
There are many tools available to help you develop libraries and applications in PureScript. These include build tools, package managers, code formatters, dead code elimination tools, GitHub Actions, Nix tools, and more.
There are several build tools and package managers available for PureScript.
- spago is the standard package manager and build tool for Purescript.
These build tools are maintained, but are no longer recommended for most projects (use Spago instead):
- psc-package is a package manager for PureScript based on package-sets and a precursor to Spago.
- pulp is a standalone build system for PureScript which relies on Bower for package management and a precursor to Spago.
- purescript-backend-optimizer is an optimizing backend toolkit for PureScript's CoreFn and a code-generator which outputs modern ECMAScript.
- setup-purescript is a GitHub Action which sets up a PureScript toolchain with common tools including the compiler and Spago for continuous integration.
- purs-tidy is a formatter and pretty-printer for PureScript code.
- zephyr is a dead code elimination tool for PureScript applications which can be used to reduce bundle sizes.
There are some tools meant specifically for Nix users, who may not be able to use installation methods like NPM.
- easy-purescript-nix provides many common tools in the PureScript community like the compiler (
purs
),spago
,pscid
,zephyr
, and more for Nix environments. - purs-nix provides support for official package-set, namespaces and overlays on Nix without a external package manager (like spago).
- purifix package manager in nix using spago (spago.yaml) as single source of truth.
- spago2nix helps you generate Nix expressions for your Spago dependencies.
- yarn2nix helps you generate Nix expressions for your JavaScript dependencies.
PureScript projects which use alternate backends may use tools from the ecosystem of the target language. This documentation is a non-exhaustive starting point for some tools you may find useful when working with particular backends for PureScript.
PureScript projects which target JavaScript may find some tools from the JavaScript ecosystem. PureScript code which imports libraries from JavaScript will at least require a JavaScript package manager (to install dependencies) and a JavaScript bundling tool (to resolve JavaScript imports, among other things). You may also want to use a linter for any JavaScript code you are writing via the FFI.
- Some popular package managers in JavaScript include npm (recommended), yarn, and pnpm.
- The recommended way to bundle PureScript code is by using Spago's
spago bundle
command, which uses esbuild. Other popular bundlers include webpack with the purs-loader PureScript loader, and parcel. - Some popular linters include eslint and jsconfig.
- purerlex integrates Purerl code compilation process with BEAM platform's Mix project management tool.
These tools were previously mentioned in this documentation, but are no longer maintained or recommended:
- purty was a PureScript code formatter and pretty-printer.
- gulp-purescript was a Gulp task for Purescript.
- psvm-js was a version manager (like
nvm
for Node) for PureScript compiler versions. - psc-pane provided auto-reloading builds which formatted a single error to fit the window.