| readline-1.0.1.0: An interface to the GNU readline library | Source code | Contents | Index
System.Console.Readline |
Portability | non-portable (requires libreadline)
Stability | provisional
Maintainer | libraries@haskell.org
Description
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)
                        readEvalPrintLoop
Synopsis
readline :: String -> IO (Maybe String)
addHistory :: String -> IO ()
getLineBuffer :: IO String
setLineBuffer :: String -> IO ()
getPoint :: IO Int
setPoint :: Int -> IO ()
getEnd :: IO Int
setEnd :: Int -> IO ()
getMark :: IO Int
setMark :: Int -> IO ()
setDone :: Bool -> IO ()
setPendingInput :: Char -> IO ()
setEraseEmptyLine :: Bool -> IO ()
getPrompt :: IO String
setAlreadyPrompted :: Bool -> IO ()
getLibraryVersion :: IO String
getTerminalName :: IO String
setReadlineName :: String -> IO ()
getInStream :: IO Handle
getOutStream :: IO Handle
setStartupHook :: Maybe (IO ()) -> IO ()
setPreInputHook :: Maybe (IO ()) -> IO ()
setEventHook :: Maybe (IO ()) -> IO ()
setRedisplayFunction :: Maybe (IO ()) -> IO ()
data Keymap
newBareKeymap :: IO Keymap
copyKeymap :: Keymap -> IO Keymap
newKeymap :: IO Keymap
freeKeymap :: Keymap -> IO ()
getKeymap :: IO Keymap
setKeymap :: Keymap -> IO ()
getKeymapByName :: String -> IO Keymap
getKeymapName :: Keymap -> IO (Maybe String)
getExecutingKeymap :: IO Keymap
getBindingKeymap :: IO Keymap
type Callback = Int -> Char -> IO Int
addDefun :: String -> Callback -> Maybe Char -> IO ()
bindKey :: Char -> Callback -> IO ()
bindKeyInMap :: Char -> Callback -> Keymap -> IO ()
unbindKey :: Char -> IO ()
unbindKeyInMap :: Char -> Keymap -> IO ()
unbindCommandInMap :: String -> Keymap -> IO ()
data Entry
= Function Callback
| Macro String
| Keymap Keymap
genericBind :: String -> Entry -> Keymap -> IO ()
parseAndBind :: String -> IO ()
readInitFile :: String -> IO ()
namedFunction :: String -> IO (Maybe Callback)
functionOfKeyseq :: String -> Maybe Keymap -> IO Entry
functionDumper :: Bool -> IO ()
listFunmapNames :: IO ()
funmapNames :: IO [String]
beginUndoGroup :: IO ()
endUndoGroup :: IO ()
data UndoCode
= UndoDelete
| UndoInsert
| UndoBegin
| UndoEnd
addUndo :: UndoCode -> Int -> Int -> String -> IO ()
freeUndoList :: IO ()
doUndo :: IO Bool
modifying :: Int -> Int -> IO ()
redisplay :: IO ()
forcedUpdateDisplay :: IO ()
onNewLine :: IO ()
onNewLineWithPrompt :: IO ()
resetLineState :: IO ()
message :: String -> IO ()
clearMessage :: IO ()
savePrompt :: IO ()
restorePrompt :: IO ()
insertText :: String -> IO ()
deleteText :: Int -> Int -> IO ()
copyText :: Int -> Int -> IO String
killText :: Int -> Int -> IO ()
readKey :: IO Char
stuffChar :: Char -> IO Bool
initialize :: IO ()
resetTerminal :: Maybe String -> IO ()
ding :: IO Bool
displayMatchList :: [String] -> IO ()
callbackHandlerInstall :: String -> (String -> IO ()) -> IO (IO ())
callbackReadChar :: IO ()
setCatchSignals :: Bool -> IO ()
getCatchSignals :: IO Bool
setCatchSigwinch :: Bool -> IO ()
getCatchSigwinch :: IO Bool
cleanupAfterSignal :: IO ()
freeLineState :: IO ()
resetAfterSignal :: IO ()
resizeTerminal :: IO ()
setSignals :: IO ()
clearSignals :: IO ()
completeInternal :: Char -> IO ()
complete :: Int -> Char -> IO Int
possibleCompletions :: Int -> Char -> IO Int
insertCompletions :: 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 ()
setFilenameQuotingFunction :: Maybe (String -> Bool -> Ptr CChar -> IO String) -> IO ()
quoteFilename :: String -> Bool -> Ptr CChar -> IO String
setFilenameDequotingFunction :: Maybe (String -> Maybe Char -> IO String) -> IO ()
setCharIsQuotedP :: Maybe (String -> Int -> IO Bool) -> IO ()
getCompletionQueryItems :: IO Int
setCompletionQueryItems :: Int -> IO ()
getBasicWordBreakCharacters :: IO String
setBasicWordBreakCharacters :: String -> IO ()
getBasicQuoteCharacters :: IO String
setBasicQuoteCharacters :: String -> IO ()
getCompleterWordBreakCharacters :: IO String
setCompleterWordBreakCharacters :: String -> IO ()
getCompleterQuoteCharacters :: IO String
setCompleterQuoteCharacters :: String -> IO ()
getFilenameQuoteCharacters :: IO String
setFilenameQuoteCharacters :: String -> IO ()
getSpecialPrefixes :: IO String
setSpecialPrefixes :: String -> IO ()
getCompletionAppendCharacter :: IO (Maybe Char)
setCompletionAppendCharacter :: Maybe Char -> IO ()
setIgnoreCompletionDuplicates :: Bool -> IO ()
getIgnoreCompletionDuplicates :: IO Bool
setFilenameCompletionDesired :: Bool -> IO ()
getFilenameCompletionDesired :: IO Bool
setFilenameQuotingDesired :: Bool -> IO ()
getFilenameQuotingDesired :: IO Bool
setInhibitCompletion :: Bool -> IO ()
getInhibitCompletion :: IO Bool
setAttemptedCompletionOver :: Bool -> IO ()
getAttemptedCompletionOver :: IO Bool
setIgnoreSomeCompletionsFunction :: Maybe ([String] -> IO [String]) -> IO ()
setDirectoryCompletionHook :: Maybe (String -> IO String) -> IO ()
setCompletionWordBreakHook :: Maybe (IO (Maybe String)) -> IO ()
setCompletionDisplayMatchesHook :: Maybe ([String] -> IO ()) -> IO ()
Documentation
readline | Source
:: String | prompt
-> 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.
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.
getLineBuffer :: IO String | Source
setLineBuffer :: String -> IO () | Source
getPoint :: IO Int | Source
setPoint :: Int -> IO () | Source
getEnd :: IO Int | Source
setEnd :: Int -> IO () | Source
getMark :: IO Int | Source
setMark :: Int -> IO () | Source
setDone :: Bool -> IO () | Source
setPendingInput :: Char -> IO () | Source
setEraseEmptyLine :: Bool -> IO () | Source
getPrompt :: IO String | Source
setAlreadyPrompted :: Bool -> IO () | Source
getLibraryVersion :: IO String | Source
getTerminalName :: IO String | Source
setReadlineName :: String -> IO () | Source
getInStream :: IO Handle | Source
getOutStream :: IO Handle | Source
setStartupHook :: Maybe (IO ()) -> IO () | Source
setPreInputHook :: Maybe (IO ()) -> IO () | Source
setEventHook :: Maybe (IO ()) -> IO () | Source
setRedisplayFunction :: Maybe (IO ()) -> IO () | Source
data Keymap | Source
newBareKeymap :: IO Keymap | Source
copyKeymap :: Keymap -> IO Keymap | Source
newKeymap :: IO Keymap | Source
freeKeymap :: Keymap -> IO () | Source
getKeymap :: IO Keymap | Source
setKeymap :: Keymap -> IO () | Source
getKeymapByName :: String -> IO Keymap | Source
getKeymapName :: Keymap -> IO (Maybe String) | Source
getExecutingKeymap :: IO Keymap | Source
getBindingKeymap :: IO Keymap | Source
type Callback = Int -> Char -> IO Int | Source
addDefun :: String -> Callback -> Maybe Char -> IO () | Source
bindKey :: Char -> Callback -> IO () | Source
bindKeyInMap :: Char -> Callback -> Keymap -> IO () | Source
unbindKey :: Char -> IO () | Source
unbindKeyInMap :: Char -> Keymap -> IO () | Source
unbindCommandInMap :: String -> Keymap -> IO () | Source
data Entry | Source
Constructors
Function Callback |
Macro String |
Keymap Keymap |
genericBind :: String -> Entry -> Keymap -> IO () | Source
parseAndBind :: String -> IO () | Source
readInitFile :: String -> IO () | Source
namedFunction :: String -> IO (Maybe Callback) | Source
functionOfKeyseq :: String -> Maybe Keymap -> IO Entry | Source
functionDumper :: Bool -> IO () | Source
listFunmapNames :: IO () | Source
funmapNames :: IO [String] | Source
beginUndoGroup :: IO () | Source
endUndoGroup :: IO () | Source
data UndoCode | Source
Constructors
UndoDelete |
UndoInsert |
UndoBegin |
UndoEnd |
addUndo :: UndoCode -> Int -> Int -> String -> IO () | Source
freeUndoList :: IO () | Source
doUndo :: IO Bool | Source
modifying :: Int -> Int -> IO () | Source
redisplay :: IO () | Source
forcedUpdateDisplay :: IO () | Source
onNewLine :: IO () | Source
onNewLineWithPrompt :: IO () | Source
resetLineState :: IO () | Source
message :: String -> IO () | Source
clearMessage :: IO () | Source
savePrompt :: IO () | Source
restorePrompt :: IO () | Source
insertText :: String -> IO () | Source
deleteText :: Int -> Int -> IO () | Source
copyText :: Int -> Int -> IO String | Source
killText :: Int -> Int -> IO () | Source
readKey :: IO Char | Source
stuffChar :: Char -> IO Bool | Source
initialize :: IO () | Source
resetTerminal :: Maybe String -> IO () | Source
ding :: IO Bool | Source
displayMatchList :: [String] -> IO () | Source
callbackHandlerInstall :: String -> (String -> IO ()) -> IO (IO ()) | Source
callbackReadChar :: IO () | Source
setCatchSignals :: Bool -> IO () | Source
getCatchSignals :: IO Bool | Source
setCatchSigwinch :: Bool -> IO () | Source
getCatchSigwinch :: IO Bool | Source
cleanupAfterSignal :: IO () | Source
freeLineState :: IO () | Source
resetAfterSignal :: IO () | Source
resizeTerminal :: IO () | Source
setSignals :: IO () | Source
clearSignals :: IO () | Source
completeInternal :: Char -> IO () | Source
complete :: Int -> Char -> IO Int | Source
possibleCompletions :: Int -> Char -> IO Int | Source
insertCompletions :: Int -> Char -> IO Int | Source
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
setFilenameQuotingFunction :: Maybe (String -> Bool -> Ptr CChar -> IO String) -> IO () | Source
quoteFilename :: String -> Bool -> Ptr CChar -> IO String | Source
setFilenameDequotingFunction :: Maybe (String -> Maybe Char -> IO String) -> IO () | Source
setCharIsQuotedP :: Maybe (String -> Int -> IO Bool) -> IO () | Source
getCompletionQueryItems :: IO Int | Source
setCompletionQueryItems :: Int -> IO () | Source
getBasicWordBreakCharacters :: IO String | Source
setBasicWordBreakCharacters :: String -> IO () | Source
getBasicQuoteCharacters :: IO String | Source
setBasicQuoteCharacters :: String -> IO () | Source
getCompleterWordBreakCharacters :: IO String | Source
setCompleterWordBreakCharacters :: String -> IO () | Source
getCompleterQuoteCharacters :: IO String | Source
setCompleterQuoteCharacters :: String -> IO () | Source
getFilenameQuoteCharacters :: IO String | Source
setFilenameQuoteCharacters :: String -> IO () | Source
getSpecialPrefixes :: IO String | Source
setSpecialPrefixes :: String -> IO () | Source
getCompletionAppendCharacter :: IO (Maybe Char) | Source
setCompletionAppendCharacter :: Maybe Char -> IO () | Source
setIgnoreCompletionDuplicates :: Bool -> IO () | Source
getIgnoreCompletionDuplicates :: IO Bool | Source
setFilenameCompletionDesired :: Bool -> IO () | Source
getFilenameCompletionDesired :: IO Bool | Source
setFilenameQuotingDesired :: Bool -> IO () | Source
getFilenameQuotingDesired :: IO Bool | Source
setInhibitCompletion :: Bool -> IO () | Source
getInhibitCompletion :: IO Bool | Source
setAttemptedCompletionOver :: Bool -> IO () | Source
getAttemptedCompletionOver :: IO Bool | Source
setIgnoreSomeCompletionsFunction :: Maybe ([String] -> IO [String]) -> IO () | Source
setDirectoryCompletionHook :: Maybe (String -> IO String) -> IO () | Source
setCompletionWordBreakHook :: Maybe (IO (Maybe String)) -> IO () | Source
setCompletionDisplayMatchesHook :: Maybe ([String] -> IO ()) -> IO () | Source
Produced by Haddock version 0.9