DO NOT USE (work in progress, maybe)

License: BSD-3-Clause

Language: Haskell


This is a platform-native compiler backend for PureScript. It attempts to generate "sane", debuggable, and portable C++11 (or later) or Go code as an intermediate language, which is then compiled to a native executable binary. This also enables easy interoperability with existing C/C++ or Go frameworks and libraries on a number of platforms.

There are two utilities in the purescript-native "suite": pscpp and psgo. The source code in this branch is for psgo, the purescript-to-Go transpiler. For the source code of the pscpp purescript-to-C++ transpiler, please see the cpp branch.


  • Although purescript-native should work on any platform supporting PureScript and modern C++ or Go, the generated code and resulting binary executables have been tested on:
    • macOS Mojave 10.14.5 – full test suite
      • For C++, Xcode 10.2.1's clang was used
      • For Go, go version 1.12.7 was used
    • Windows 10 x64 – full test suite
      • C++: Visual Studio 2017 and clang
      • Go: go version 1.12.7
    • Linux Debian 9.5 amd64 – full test suite (C++)
      • Default versions of clang and gcc
    • Linux Debian 10 amd64 – full test suite (Go)
      • Default version of go
    • Raspberry Pi 3 B+ Raspbian official build (ARM), default versions of clang and gcc

Requirements for building pscpp and psgo

  • Haskell Stack (if you're running macOS 10.14.5+, you can use pre-built binaries from here)

Requirements for using PureScript + purescript-native

  • A recent version (0.13+) of purescript.

  • For pscpp, a C++11-capable toolchain, e.g. recent versions of clang, gcc, Microsoft Visual Studio

    • GNU Make + psc-package is the default supported build tool, but you should be able to use your favorite package manager, C++ build system, tools, debuggers, etc.
  • For psgo, the Go toolchain for your system

    • You can use your favorite PureScript package manager and build tools – but for simplicity, spago is recommended.

For more information and a Getting Started guide, please see

Notes on use with MATLAB in Nix

Several nix-shell executions are required to get things working. Hopefully this can be improved in the future.

export BDIR=`pwd` # do this from a project directory
nix-shell ci.nix # from justinwoo/easy-purescript-nix
# Now to get MATLAB working, example here is from FederatedCloud/COBRAContainers
cd ~/workspace/COBRAContainers/nix/shells/MATLAB && nix-shell

spago build --purs-args "-g corefn" && cd $HOME/workspace/purescript-dynlangs && stack --no-nix-pure exec psmatlab --cwd $BDIR; cd $BDIR

Project Statistics

Sourcerank 3
Repository Size 8.23 MB
Stars 0
Forks 0
Watchers 1
Open issues 2
Dependencies 0
Contributors 108
Tags 0
Last updated
Last pushed

Top Contributors See all

Phil Freeman Gary Burgess Andy Arvanitis Harry Garrood Hardy Jones Christoph Hegemann Brian McKenna Oleg Grenrus Nicholas Wolverson Antoine R. Dumont Liam Goodacre Benjamin Kovach Michael Ficarra Brandon Elam Barker Bogdan Popa Łukasz Hanuszczak JP Smith Michael Gilliland Tibor Erdesz Konstantin Zudov

Something wrong with this page? Make a suggestion

Last synced: 2019-10-28 20:02:52 UTC

Login to resync this repository