How to add readline support in polyml interpreter?

The simplest way to add readline support to a terminal program that does not natively support it, is to call the program using rlwrap. You can install the package of the same name through several package managers. Pressing in the examples below:

$ poly
Poly/ML 5.7.1 Release
- ^[[A

You can run it like this:

$ rlwrap poly
Poly/ML 5.7.1 Release
- stuff I typed from last session;

Or you can add an alias in your ~/.bashrc or similar:

alias poly='rlwrap poly'

The following two QA answers your question, though for sml/nj. It should not be any different for polyml

  • Conque SML backspace
  • How to 'fix' the SML/NJ interactive system to use Arrow Keys