WIP
Elisp is powerful and flexible, but when it comes to complex logic code, some might prefer strongly typed language. Since it is possible to call PS functions from elisp, it is possible to write partially in PS. Also, you can reuse PureScript libraries as long as they do not depend on JS/browser specific libraries.
Currently, there is no release yet. To install psel command, you can build from source or use nix to install.
Requires cabal-install and GHC 8.10.7.
git clone git@github.com:psel-org/psel.git
cd psel
cabal install
Requires nix >= 2.4.
nix profile install github:psel-org/psel
Psel is intended to use through Spago. Set backend = "psel" in your spago.dhall file.
There is no package-set release yet. You can use WIP package-set https://raw.githubusercontent.com/psel-org/package-sets/main/src/el-0.14.5-20211116/packages.dhall for now.
{ name = "your-project-name"
, dependencies = [ "prelude" ]
, packages = https://raw.githubusercontent.com/psel-org/package-sets/main/src/el-0.14.5-20211116/packages.dhall
, backend = "psel"
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
}spago build will output all .el files under output.el directory. To require from emacs, add this path to load-path variable.
Data.Foo module will be transpiled to Data.Foo.el.
Top-level binding fooBar in Data.Foo module will be transpiled to (defvar Data.Foo.fooBar ...).
| Purescript | Elisp |
|---|---|
| Int | Integer |
| Double | Double |
| String | String |
| Array | Vector |
| Char | Integer(elisp doen't have char type) |
| Boolean | True -> t, False -> nil (elisp doesn't have boolean type) |
| Records | alist (e.g. (('foo . 1) ('bar . "a"))) |
| Unit | nil |
| Data types | Vector with constructor tag symbol in first slot and arguments in the remaining slots. Constructor with no argument will be represented by tag symbol only. e.g. Just 42 -> ['Just 42]e.g. Nothing -> 'Nothing |
| Tuple | Tuple a b -> (cons a b) |
| List | Cons 1 (Cons 2 Nil)) -> (list 1 2) |
Currently, TCO is only applied to certain forms of self-recursion functions.
TCO will convert these self-resursive calls to while s-exp expression.
Implemented only for Effect monad.
ST monad remains unoptimized. Also whileE and forE combinator of Effect monad is also untouched.
Not done yet.
Data.Function.Uncurried(funcitons package) and Effect.Uncurried(effects pacakge)
- Support FFI
- Prelude fork
- Make an github orgiznation
- Make psel command spago friendly
- Create package-set
- Implement TCO
- Implement MagicDo
- Support core libraries(WIP)
- Minimal example and add Usage document
- purescript-emacs
- Support contrib libraries
- Write some tests
- Add flake.nix
- Setup CI
Learned how to write a CoreFn-type PureScript backend from purenix and purerl.