At the moment, not everything works.
For example, the `:r` command (which is supposed to reset the loaded modules of the current session) does nothing (but it does work in a terminal session).
Major mode for purescript’s repl psci.
Based on comint-mode (command interpreter). Following this tutorial.
The purescript-mode (forked from haskell-mode) does not provide any repl integration (yet?). The experience inside the terminal is somewhat tedious at the moment. So I thought of giving it a shot.
How about now? (work in progress)
Many different installation possible:
Clone the repository, and:
M-x package-install-file RET /path/to/emacs-psci/psci.el
Note Provided you already use melpa, the needed deps should be installed.
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages") t)
(package-initialize)
Note Providing PR is merged.
(require 'package)
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/") t
(package-initialize)
(require 'package)
(add-to-list 'package-archives '("marmalade" . "https://marmalade-repo.org/packages/"))
(package-initialize)
With melpa, melpa-stable, marmalade:
M-x package-install RET psci RET
M-x el-get-install RET psci RET
Note Providing PR is merged.
M-x psci
This will open a psci repl in your project root folder (using projectile to determine that).
I encounter (thanks to @purcell) a simple mode that I quite like which is called repl-toggle. This permits, using the same universal binding `C-c C-z`, to go back and forth between the repl and the buffer.
(require 'repl-toggle)
(require 'psci)
(add-to-list 'rtog/mode-repl-alist '(purescript-mode . psci))
Default bindings for this mode:
Keybindings | Interactive commands | Description |
---|---|---|
<kbd>C-c C-l</kbd> | <kbd>M-x psci/load-current-file!</kbd> | Equivalent of `:m /path/to/current/module/file.purs` |
<kbd>C-c M-n</kbd> | <kbd>M-x psci/load-module!</kbd> | Equivalent of `:i your.current.module.name` |
<kbd>C-c C-r</kbd> | <kbd>M-x psci/load-project-modules!</kbd> | Load or reload modules defined in your project file .psci |
N/A | <kbd>M-x psci/reset!</kbd> | Equivalent of :r |
<kbd>C-c C-z</kbd> | Provided you use the previous setup, this will switch back and forth between repl and buffer |
A purescript dev platform ready. I based this development on the online book https://leanpub.com/purescript/.
More than welcome. Send me a PR and I will gladly merge it.
Simply, use fork, branch, and rebase to the latest commit. Also, I prefer code that is understandable (ymmv) and doc-stringified.
Issues, there will be.
Open issues on the tracker, I’ll do my best to answer.
Just, be sure to be clear, complete and concise about what your trouble is.
I’m open to suggestions but I’m far from being omniscient. Please, add information links, this helps everyone.
I tend to rely on other people’s code. That’s why I use a lot of dependencies. I’ll remove the unnecessary dependencies (for the moment, none but surely, some code can be rewritten without the deps) later.