Skip to content

Unisay/purescript-lua

Repository files navigation

Purescript Backend for Lua

Status: (2023-07-05) the project is in the "ready to be experimented with" state (read: it likely contains bugs but is already usable).

Features

  • Lua code bundling: emits either a Lua module or "App".
  • FFI with Lua.
  • Dead Code Elimination (DCE).
  • Code inlining.
  • Package Set for PureScript/Lua libs.
  • All core libs added to the package set.

Quick Start

For the moment the best way to start is to use nix to intall pslua.

Here is an example project.

If you use Spago to build your PureScript project, then you can configure pslua as a custom backend like this:

spago.dhall

Assuming that pslua executable is already available on your PATH

{ name = "acme-project"
, dependencies = [ "effect", "prelude" ]
, packages = ./packages.dhall
, sources = [ "src/**/*.purs" ]
, backend =
    ''
    pslua \
    --foreign-path . \
    --ps-output output \
    --lua-output-file dist/acme.lua \
    --entry Acme.Main
    ''
}

Using nix with flakes

nix run 'github:Unisay/purescript-lua' -- --help

Installation

Using nix with flakes

nix profile install 'github:Unisay/purescript-lua'

will make pslua executable available for use.

About

Purescript compiler back-end for Lua

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •