Next: Collapsing Haskell code, Previous: Rectangular commands, Up: Top [Index]
To start the REPL you can run one of the following:
This repl works with Comint. So you will feel at home if you are already using M-x Shell or M-x ielm.
Inf-Haskell
is a Major mode for running GHCi, with comint.
Important key bindings in Inf-haskell
:
invokes comint-send-input. Sends the input to the GHCi process, evaluates the line and returns the output.
deletes the forward character
invokes comint-previous-input. Cycle backwards through input history, saving input.
invokes comint-next-input. Cycle forwards through input history.
invokes comint-interrupt-subjob. Sends KeyboardInterrupt signal.
invokes comint-quit-subjob. Sends KeyboardInterrupt signal.
invokes comint-stop-subjob. Kills the GHCi process.
invokes comint-previous-matching-input-from-input. If you are familiar with C-r in bash. This is the same as that. Searches backwards through input history for match for current input.
invokes comint-next-matching-input-from-input. Searches forwards through input history for match for current input.
invokes comint-dynamic-list-input-ring. Displays a list of recent inputs entered into the current buffer.
invokes comint-clear-buffer. Clears the buffer (Only with Emacs 25.X and above)
invokes comint-next-prompt. Goes to the start of the previous REPL prompt.
invokes comint-previous-prompt. Goes to the start of the next REPL prompt.
invokes comint-delete-output. Clears the output of the most recently evaluated expression.
invokes comint-show-maximum-output. Moves the point to the end of the buffer.
invokes comint-kill-input. Kills backward, the line at point. (Use this when you have typed in an expression into the prompt but you dont want to evaluate it.)
invokes backward-kill-word. Kills backward, the word at point
invokes comint-write-output. Write output from interpreter since last input to FILENAME. Any prompt at the end of the output is not written.
Interpreter (defcustom) | Default Value | Possible Values |
---|---|---|
haskell-process-type | 'auto | 'stack-ghci, 'cabal-repl, 'ghci, 'auto |
inferior-haskell-hook | nil | - |
haskell-process-path-ghci | ghci | - |
haskell-process-args-ghci | -ferror-spans | - |
haskell-process-path-cabal | cabal | - |
haskell-process-args-cabal-repl | --ghc-option=-ferror-spans | - |
haskell-process-path-stack | stack | - |
haskell-process-args-stack-ghci | --ghci-options=-ferror-spans --no-build --no-load | - |
haskell-process-type
The Haskell interpreter used by Inf-Haskell
is auto-detected by default,
but is customizable with defcustom haskell-process-type
. The values
recognized by it are (default is ’auto):
'stack-ghci
'cabal-repl
'ghci
'auto
if the haskell-process-type
is 'auto
, the directories are searched for
cabal.sandbox.config
or stack.yaml
or *.cabal
file.
If the file is present, then appropriate process is started.
When cabal.sandbox.config
is found haskell-process-type
is 'cabal-repl
.
Similarly, when stack.yaml
is found haskell-process-type
is 'stack-ghci
.
Similarly, when xyz.cabal
is found haskell-process-type
is 'cabal-repl
.
When nothing is found haskell-process-type
is 'ghci
. When more than one
file such as cabal.sandbox.config
and stack.yaml
are found the following
preference is followed.
cabal.sandbox.config
> stack.yaml
> *.cabal
Next: Collapsing Haskell code, Previous: Rectangular commands, Up: Top [Index]