{"id":16592631,"url":"https://github.com/unisay/purescript-lua","last_synced_at":"2025-03-21T13:31:37.705Z","repository":{"id":160678150,"uuid":"587200487","full_name":"Unisay/purescript-lua","owner":"Unisay","description":"Purescript compiler back-end for Lua","archived":false,"fork":false,"pushed_at":"2024-04-16T07:27:34.000Z","size":587,"stargazers_count":45,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-16T07:29:43.925Z","etag":null,"topics":["compiler","lua","purescript"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Unisay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-01-10T07:36:02.000Z","updated_at":"2024-04-17T19:39:36.589Z","dependencies_parsed_at":"2023-06-05T00:45:48.266Z","dependency_job_id":"b1ddc05a-e1b0-445e-b914-0b0b4859ab06","html_url":"https://github.com/Unisay/purescript-lua","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Unisay%2Fpurescript-lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Unisay%2Fpurescript-lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Unisay%2Fpurescript-lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Unisay%2Fpurescript-lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Unisay","download_url":"https://codeload.github.com/Unisay/purescript-lua/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221815636,"owners_count":16885197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler","lua","purescript"],"created_at":"2024-10-11T23:21:36.557Z","updated_at":"2024-10-28T10:12:35.326Z","avatar_url":"https://github.com/Unisay.png","language":"Haskell","readme":"# Purescript Backend for Lua\n\n[![Purescript Lua CI](https://github.com/Unisay/purescript-lua/actions/workflows/ci.yaml/badge.svg)](https://github.com/Unisay/purescript-lua/actions/workflows/ci.yaml)\n\n🔋 Status: (2024-04-20) the project is in the \"_ready to be experimented with_\" state (read: it likely contains bugs but is already usable). \n\n💡 If you have an idea on how to use Purescript to Lua compilation please contribute it here:\nhttps://github.com/Unisay/purescript-lua/discussions/categories/ideas\n\n## Features\n\n- [x] Lua code bundling: emits either a Lua module (a file that returns a table with functions) or an application (a file that executes itself).\n- [x] FFI with Lua.\n- [x] Dead Code Elimination (DCE).\n- [x] Code inlining.\n- [x] [Package Set](https://github.com/Unisay/purescript-lua-package-sets) for PureScript/Lua libs.\n- [x] All core libs added to the package set.\n\n## Quick Start\n\nFor the moment the best way to start is to use `nix` to intall `pslua`.\n\nConsider configuring [Cachix](https://docs.cachix.org/installation) as a binary nix cache to avoid rebuilding a ton of dependencies:\n\n```\ncachix use purescript-lua\n```\nYou can use this [template repository](https://github.com/Unisay/purescript-lua-template) to initialize your project.\n\nHere is an another [example](https://github.com/Unisay/purescript-lua-example) project: Nginx server running Lua code using [OpenResty](https://openresty.org/).\n\nIf you use [Spago](https://github.com/purescript/spago) to build your PureScript project, then you can configure `pslua` as a custom backend like this:\n\n\u003cdetails\u003e \u003csummary\u003espago.dhall\u003c/summary\u003e\n\nAssuming that `pslua` executable is already available on your PATH\n\n```dhall\n{ name = \"acme-project\"\n, dependencies = [ \"effect\", \"prelude\" ]\n, packages = ./packages.dhall\n, sources = [ \"src/**/*.purs\" ]\n, backend =\n    ''\n    pslua \\\n    --foreign-path . \\\n    --ps-output output \\\n    --lua-output-file dist/Acme_Main.lua \\\n    --entry Acme.Main\n    ''\n}\n```\n\n\u003c/details\u003e\n\n### Using nix with flakes\n\n```\nnix run 'github:Unisay/purescript-lua' -- --help\n```\n\n## Installation\n\nIf you're on a x86 64bit Linux system then you can download a pre-built executable from the [releases](https://github.com/Unisay/purescript-lua/releases) page:\n\n```\nwget -c https://github.com/Unisay/purescript-lua/releases/download/0.1.1-alpha/pslua-linux_x86_64.tar.gz -O - | tar -xz\n```\n\nalternatively,\n\n### Using nix with flakes\n\n```\nnix profile install 'github:Unisay/purescript-lua'\n```\n\nwill make `pslua` executable available for use.\n\n### Windows\n\nNix build won't work on Windows so you'd first need to  install\n`cabal` and `ghc-9.4.8` (One way of installing those is [GHCUp](https://www.haskell.org/ghcup/)).\n\nOnce the pre-requisites are available on your PATH\nyou run\n\n```\ncabal install exe:pslua\n\n.... elided ....\n\nInstalling   commutative-semigroups-0.1.0.1 (lib)\nInstalling   primes-0.2.1.0 (all, legacy fallback)\nInstalling   base16-bytestring-1.0.2.0 (lib)\nInstalling   quiet-0.2 (lib)\nCompleted    newtype-0.2.2.0 (lib)\n\n.... elided ....\n\nStarting     pslua-0.1.0.0 (exe:pslua)\nBuilding     pslua-0.1.0.0 (exe:pslua)\nInstalling   pslua-0.1.0.0 (exe:pslua)\nCompleted    pslua-0.1.0.0 (exe:pslua)\nCopying 'pslua.exe' to 'C:\\cabal\\bin\\pslua.exe'\n```\n\nThis will build and install executable `pslua.exe`\n\n```\nC:\\cabal\\bin\\pslua --help\npslua - a PureScript backend for Lua\n\nUsage: pslua.exe [--foreign-path FOREIGN-PATH] [--ps-output PS-PATH]\n                 [--lua-output-file LUA-OUT-FILE] [-e|--entry ENTRY]\n\n  Compile PureScript's CoreFn to Lua\n\nAvailable options:\n  --foreign-path FOREIGN-PATH\n                           Path to a directory containing foreign files.\n                           Default: foreign\n  --ps-output PS-PATH      Path to purs output directory.\n                           Default: output\n  --lua-output-file LUA-OUT-FILE\n                           Path to write compiled Lua file to.\n                           Default: main.lua\n  -e,--entry ENTRY         Where to start compilation.\n                           Could be one of the following formats:\n                           - Application format: \u003cModule\u003e.\u003cbinding\u003e\n                             Example: Acme.App.main\n                           - Module format: \u003cModule\u003e\n                             Example: Acme.Lib\n                           Default: Main.main\n  -h,--help                Show this help text\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funisay%2Fpurescript-lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funisay%2Fpurescript-lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funisay%2Fpurescript-lua/lists"}