Safe Haskell | None |
---|---|
Language | GHC2021 |
Effects.Haskeline
Contents
Description
Warning: Effects.Haskeline is experimental and subject to change.
Synopsis
- class Monad m => MonadHaskeline (m :: Type -> Type) where
- haveTerminalUI :: m Bool
- getInputLine :: String -> m (Maybe String)
- getInputLineWithInitial :: String -> (String, String) -> m (Maybe String)
- getInputChar :: String -> m (Maybe Char)
- getPassword :: Maybe Char -> String -> m (Maybe String)
- waitForAnyKey :: String -> m Bool
- outputStr :: String -> m ()
- outputStrLn :: String -> m ()
- getHistory :: m History
- putHistory :: History -> m ()
- modifyHistory :: (History -> History) -> m ()
- withInterrupt :: HasCallStack => m a -> m a
- handleInterrupt :: HasCallStack => m a -> m a -> m a
- runInputT :: (MonadIO m, MonadMask m) => Settings m -> InputT m a -> m a
- runInputTBehavior :: (MonadIO m, MonadMask m) => Behavior -> Settings m -> InputT m a -> m a
- runInputTBehaviorWithPrefs :: (MonadIO m, MonadMask m) => Behavior -> Prefs -> Settings m -> InputT m a -> m a
- defaultSettings :: forall (m :: Type -> Type). MonadIO m => Settings m
- defaultBehavior :: Behavior
- defaultPrefs :: Prefs
Class
class Monad m => MonadHaskeline (m :: Type -> Type) where Source #
Methods
haveTerminalUI :: m Bool Source #
Lifted haveTerminalUI
.
Since: 0.1
getInputLine :: String -> m (Maybe String) Source #
Lifted getInputLine
.
Since: 0.1
getInputLineWithInitial :: String -> (String, String) -> m (Maybe String) Source #
Lifted getInputLineWithInitial
.
Since: 0.1
getInputChar :: String -> m (Maybe Char) Source #
Lifted getInputChar
.
Since: 0.1
getPassword :: Maybe Char -> String -> m (Maybe String) Source #
Lifted getPassword
.
Since: 0.1
waitForAnyKey :: String -> m Bool Source #
Lifted waitForAnyKey
.
Since: 0.1
outputStr :: String -> m () Source #
Lifted outputStr
.
Since: 0.1
outputStrLn :: String -> m () Source #
Lifted outputStrLn
.
Since: 0.1
getHistory :: m History Source #
Lifted getHistory
.
Since: 0.1
putHistory :: History -> m () Source #
Lifted putHistory
.
Since: 0.1
modifyHistory :: (History -> History) -> m () Source #
Lifted modifyHistory
.
Since: 0.1
withInterrupt :: HasCallStack => m a -> m a Source #
Lifted withInterrupt
.
Since: 0.1
handleInterrupt :: HasCallStack => m a -> m a -> m a Source #
Lifted handleInterrupt
.
Since: 0.1
Instances
IO Runners
runInputT :: (MonadIO m, MonadMask m) => Settings m -> InputT m a -> m a #
Run a line-reading application. This function should suffice for most applications.
This function is equivalent to
. It
uses terminal-style interaction if runInputTBehavior
defaultBehavior
stdin
is connected to a terminal and has
echoing enabled. Otherwise (e.g., if stdin
is a pipe), it uses file-style interaction.
If it uses terminal-style interaction, Prefs
will be read from the user's ~/.haskeline
file
(if present).
If it uses file-style interaction, Prefs
are not relevant and will not be read.
runInputTBehaviorWithPrefs :: (MonadIO m, MonadMask m) => Behavior -> Prefs -> Settings m -> InputT m a -> m a #
Run a line-reading application.
Config
defaultSettings :: forall (m :: Type -> Type). MonadIO m => Settings m #
A useful default. In particular:
defaultSettings = Settings { complete = completeFilename, historyFile = Nothing, autoAddHistory = True }
defaultPrefs :: Prefs #
The default preferences which may be overwritten in the
.haskeline
file.