editline-0.2.1.0: Bindings to the editline library (libedit).Source codeContentsIndex
System.Console.Editline.Readline
Portabilitynon-portable (requires libedit)
Stabilityprovisional
Maintainerjudah.jacobson@gmail.com
Description

This module provides a subset of the functions from System.Console.Readline, which is distributed in the readline package. However, because this package links against editline (http://www.thrysoee.dk/editline/) instead of readline, programs using this module are not required to be distributed under the GPL.

An example of a typical use of the readline API 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)
                    readEvalPrintLoop
Synopsis
readline :: String -> IO (Maybe String)
addHistory :: String -> IO ()
readHistory :: FilePath -> IO Bool
writeHistory :: FilePath -> IO Bool
clearHistory :: IO ()
stifleHistory :: Int -> IO ()
unstifleHistory :: IO Int
historyIsStifled :: IO Bool
historyMaxEntries :: IO Int
getLineBuffer :: IO String
getPoint :: IO Int
setPoint :: Int -> IO ()
getEnd :: IO Int
setEnd :: Int -> IO ()
getPrompt :: IO String
getLibraryVersion :: IO String
getTerminalName :: IO String
setReadlineName :: String -> IO ()
getInStream :: IO Handle
getOutStream :: IO Handle
setStartupHook :: Maybe (IO ()) -> IO ()
setRedisplayFunction :: Maybe (IO ()) -> IO ()
type Callback = Int -> Char -> IO Int
addDefun :: String -> Callback -> Maybe Char -> IO ()
bindKey :: Char -> Callback -> IO ()
parseAndBind :: String -> IO ()
readInitFile :: String -> IO ()
redisplay :: IO ()
readKey :: IO Char
stuffChar :: Char -> IO Bool
initialize :: IO ()
resetTerminal :: Maybe String -> IO ()
callbackHandlerInstall :: String -> (String -> IO ()) -> IO (IO ())
callbackReadChar :: IO ()
complete :: Int -> Char -> IO Int
completionMatches :: String -> (String -> IO [String]) -> IO (Maybe (String, [String]))
filenameCompletionFunction :: String -> IO [String]
usernameCompletionFunction :: String -> IO [String]
setCompletionEntryFunction :: Maybe (String -> IO [String]) -> IO ()
setAttemptedCompletionFunction :: Maybe (String -> Int -> Int -> IO (Maybe (String, [String]))) -> IO ()
getCompletionQueryItems :: IO Int
setCompletionQueryItems :: Int -> IO ()
getBasicWordBreakCharacters :: IO String
setBasicWordBreakCharacters :: String -> IO ()
getCompleterWordBreakCharacters :: IO String
setCompleterWordBreakCharacters :: String -> IO ()
getCompleterQuoteCharacters :: IO String
setCompleterQuoteCharacters :: String -> IO ()
getSpecialPrefixes :: IO String
setSpecialPrefixes :: String -> IO ()
getCompletionAppendCharacter :: IO (Maybe Char)
setCompletionAppendCharacter :: Maybe Char -> IO ()
setInhibitCompletion :: Bool -> IO ()
getInhibitCompletion :: IO Bool
setAttemptedCompletionOver :: Bool -> IO ()
getAttemptedCompletionOver :: IO Bool
Documentation
readlineSource
:: Stringprompt
-> IO (Maybe String)returns the line the user input, or Nothing if EOF is encountered.
readline is similar to System.IO.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.
addHistory :: String -> IO ()Source
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 other things.
readHistorySource
:: FilePathThe file to read.
-> IO Bool
Read in a history file. Returns False on failure (for example, if the file does not exist).
writeHistorySource
:: FilePathThe file to write.
-> IO Bool
Write out a history file. Returns False if there was a problem writing the file.
clearHistory :: IO ()Source
Clear the history.
stifleHistory :: Int -> IO ()Source
Stifle the history list, remembering only a certain number of entries.
unstifleHistory :: IO IntSource
Stop stifling the history, returning the previous amount the history was stifled by.
historyIsStifled :: IO BoolSource
Check whether the history is stifled or not. True if stifled, False if not.
historyMaxEntries :: IO IntSource
Get the maximum number of history entries, returning 0 if the history is unstifled.
getLineBuffer :: IO StringSource
getPoint :: IO IntSource
setPoint :: Int -> IO ()Source
getEnd :: IO IntSource
setEnd :: Int -> IO ()Source
getPrompt :: IO StringSource
getLibraryVersion :: IO StringSource
getTerminalName :: IO StringSource
setReadlineName :: String -> IO ()Source
getInStream :: IO HandleSource
getOutStream :: IO HandleSource
setStartupHook :: Maybe (IO ()) -> IO ()Source
setRedisplayFunction :: Maybe (IO ()) -> IO ()Source
type Callback = Int -> Char -> IO IntSource
addDefun :: String -> Callback -> Maybe Char -> IO ()Source
bindKey :: Char -> Callback -> IO ()Source
parseAndBind :: String -> IO ()Source
readInitFile :: String -> IO ()Source
redisplay :: IO ()Source
readKey :: IO CharSource
stuffChar :: Char -> IO BoolSource
initialize :: IO ()Source
resetTerminal :: Maybe String -> IO ()Source
callbackHandlerInstall :: String -> (String -> IO ()) -> IO (IO ())Source
callbackReadChar :: IO ()Source
complete :: Int -> Char -> IO IntSource
completionMatches :: String -> (String -> IO [String]) -> IO (Maybe (String, [String]))Source
filenameCompletionFunction :: String -> IO [String]Source
usernameCompletionFunction :: String -> IO [String]Source
setCompletionEntryFunction :: Maybe (String -> IO [String]) -> IO ()Source
setAttemptedCompletionFunction :: Maybe (String -> Int -> Int -> IO (Maybe (String, [String]))) -> IO ()Source
getCompletionQueryItems :: IO IntSource
setCompletionQueryItems :: Int -> IO ()Source
getBasicWordBreakCharacters :: IO StringSource
setBasicWordBreakCharacters :: String -> IO ()Source
getCompleterWordBreakCharacters :: IO StringSource
setCompleterWordBreakCharacters :: String -> IO ()Source
getCompleterQuoteCharacters :: IO StringSource
setCompleterQuoteCharacters :: String -> IO ()Source
getSpecialPrefixes :: IO StringSource
setSpecialPrefixes :: String -> IO ()Source
getCompletionAppendCharacter :: IO (Maybe Char)Source
setCompletionAppendCharacter :: Maybe Char -> IO ()Source
setInhibitCompletion :: Bool -> IO ()Source
getInhibitCompletion :: IO BoolSource
setAttemptedCompletionOver :: Bool -> IO ()Source
getAttemptedCompletionOver :: IO BoolSource
Produced by Haddock version 2.4.2