git.iko.soy/rowtype-yoga/purescript-native
on ade15d3 help sign in

A native compiler backend for PureScript (via C++ or Golang)

git clone ssh://git.iko.soy/rowtype-yoga/purescript-native

PureScript

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


Performance

Differences from PureScript:

Other notes:

Future ideas:

Requirements

Getting Started

This assumes you are running OS X or a Unix-like system (Linux, *BSD, etc.).

If you're running macOS 10.13+ (High Sierra or later), you can avoid building it yourself by using these pre-built snapshot binaries, but make sure you've installed a recent version of purescript first.

  1. Make sure you have developer tools for your system installed. For OS X, you'll need a recent version of Xcode. For Linux, etc., you need gcc 4.9.2 or later, including g++ support. You can also use clang 3.5 or later, but it still requires gcc for its C++ standard libraries.

  2. Create a working directory wherever you like, and a src subdirectory under it, which will be where you will place your own PureScript source files.

  3. Under your working directory, also create an ffi subdirectory, which will be where you will place your own C/C++ FFI source files.

  4. Copy this Makefile into your working directory.

  5. Use PureScript's standard psc-package utility to add and manage package dependencies.

  6. You should now be ready to build a PureScript program.