Interact.MakeFunctor to construct an Interactive module from a given TTY module.
Typical usage is:
module I = Interact.Make (Interact.Tty (Null)) module Tty = Tty(norm str) is str trimmed of whitespace on both ends and converted to lowercase.
This function works for ASCII only.
(read ?norm prompt) prints the prompt on Tty.ttyout and then reads a one-line normalized string from Tty.ttyin.
The default value for ~norm is id (no normalization).
(query ?norm ?what valid prompt) calls (read ?norm prompt) repeatedly until ((valid (read ?norm prompt)) = true).
~what is used as the prompt after receiving a bogus (not valid) answer; the default is "What? ".
The normalized response is returned.
The default value for ~norm is as for read.
(oneof list) is a validator for query that accepts any of the strings in list.
(whatof list) returns a string suitable for query's ~what parameter:
(query ~what:(whatof list) (oneof list)).(yorn ?norm ?what prompt) calls (read ?norm prompt) repeatedly until a "y" or "n" answer is received.
Any string beginning (after normalization) with either "y" or "n" is acceptable as an answer.
~what is as for query.
The normalized answer is returned.
yesorno is a stricter yorn that insists on a normalized answer of exactly either "yes" or "no".