|Portability||non-portable (requires libreadline)|
A Haskell binding to the GNU readline library. The GNU Readline
library provides a set of functions for use by applications that
allow users to edit command lines as they are typed in. By
default, the line editing commands are similar to those of
emacs. A vi-style line editing interface is also available.
An example of a typical use of readline with history functionality
is illustrated in the following read, eval, print loop:
readEvalPrintLoop :: IO ()
readEvalPrintLoop = do
maybeLine <- readline "% "
case maybeLine of
Nothing -> return () -- EOF / control-d
Just "exit" -> return ()
Just line -> do addHistory line
putStrLn $ "The user input: " ++ (show line)
|-> IO (Maybe String)||returns the line the user input, or Nothing if EOF is encountered.
|readline is similar to getLine, but with rich edit
functionality and history capability. readline will read a line
from the terminal and return it, using prompt as a prompt. If
prompt is the empty string, no prompt is issued. The line returned
has the final newline removed, so only the text of the line
remains. A blank line returns the empty string. If EOF is
encountered while reading a line, and the line is empty, Nothing is
returned. If an EOF is read with a non-empty line, it is treated
as a newline.
|Add this command to the history. This allows users to search backward
through history with C-r and step through with up and down arrows, among
|Produced by Haddock version 0.8|