Atomo's REPL (read evaluate print loop) is an interactive environment for reading expressions, evaluating them in some context, and printing the result.

The prompt is provided by the haskeline library, so it is readline-like, with history navigation.

The input is parsed as a block of expressions, so you can separate multiple expressions with ; or ,, in which case they will be evaluated in sequence and the last value will be printed.

It's also intelligent about multiline input, catching "unexpected ending" parse errors and allowing you to finish the expression:

[0]> "foo
.... bar"
[1]> 1 +
....   2
[2]> { a = 1
....   a + 2
....         \ print
.... } call

If the REPL jumps the gun and eats up your input before you're done and causes a parse error, an incomplete restart is provided. Triggering this restart will let you keep adding input.

To exit the REPL, you can use Ctrl+C or Ctrl+D, followed by y to confirm. Pressing Ctrl+C twice will also force it to exit.

The REPL is implemented in Atomo, so you can use it in your code.

env basic-repl  @ok

Starts up the REPL with env as the environment for evaluation.

Signals sent:


Used to determine a prompt for the input line. To set your own, trigger the use-prompt restart with your prompt (a string) as an argument.


Signaled when interaction receives an interrupt (usually by Ctrl+C) or end-of-input (usually by Ctrl-D).

@(special: name)

Signaled when a special meta-command is entered. These are arbitrary strings preceded by a colon (:).

For example, when the main REPL debugger is started, it asks for the restart to use in the form of :1, :2, and so on. When these are entered, @(special: "1"), @(special: "2") etc. are signaled.


Signaled after the REPL has evaluated and printed an input, and is about to start the loop over again.

env repl  @ok

Starts a full-blown REPL with env as the environment for evaluation. This is what is run when you just say atomo to start up Atomo's REPL - it wraps basic-repl, providing a debugger, a different prompt, prompts before exiting.


[0]> 1 repl
[0]> + 2
[1]> sqrt
really quit? (y/n) y

Note that the [3]> above is the outer REPL - as the inner one was signaling @loop, its frame number increase as well.