8

I found that polyml is the implementation of ML that can be easily installed on Ubuntu (named polyml in repository and can be executed with poly). I am following the A Gentle Introduction to ML by Andrew Cumming. After few minutes of experiment with polyml interpreter I found that it does not supports readline (pressing arrow up key produces a ^[[A).

This doesn't seems to be normal for an interpreter. This should only happen if I have no readline installed, but my Python interpreter doesn't behaves so.

Makarius
  • 2,165
  • 18
  • 20
Santosh Kumar
  • 26,475
  • 20
  • 67
  • 118

3 Answers3

11

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'
sshine
  • 15,635
  • 1
  • 41
  • 66
3

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

Community
  • 1
  • 1
Jesper.Reenberg
  • 5,944
  • 23
  • 31
1

If you are interested in Standard ML and Poly/ML you should also take a look at Isabelle/ML. Isabelle is mainly targeted as theorem proving environment, but can be used as ML system as well -- if you don't mind 300 MB download and 600-800 MB disk footprint to get a full IDE.

ML snippets can be compiled and evaluated on the spot, by embedding them into Isabelle theory source like this:

theory Scratch
imports Main
begin

ML {*
  fun f x = x + 1
*}

end

In Isabelle/jEdit this gives tooltips about inferrred types etc. -- a bit more than just readline but useful for learning SML.

Makarius
  • 2,165
  • 18
  • 20