| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
System.Console.Haskeline.Internal
Description
A module containing semi-public internals. The functions here are not stable.
Synopsis
- asks :: MonadReader r m => (r -> a) -> m a
- evalStateT' :: Monad m => s -> StateT s m a -> m a
- gets :: MonadState s m => (s -> a) -> m a
- modify :: MonadState s m => (s -> s) -> m ()
- orElse :: Monad m => MaybeT m a -> m a -> m a
- runReaderT' :: r -> ReaderT r m a -> m a
- update :: MonadState s m => (s -> (a, s)) -> m a
- mapReaderT :: (m a -> n b) -> ReaderT r m a -> ReaderT r n b
- mapStateT :: (m (a, s) -> n (b, s)) -> StateT s m a -> StateT s n b
- class Monad m => MonadIO (m :: Type -> Type) where
- class Monad m => MonadReader r (m :: Type -> Type) where
- ask :: m r
- class Monad m => MonadState s (m :: Type -> Type) where
- class (forall m. Monad m => Monad (t m)) => MonadTrans (t :: (Type -> Type) -> Type -> Type) where
- newtype MaybeT (m :: Type -> Type) a = MaybeT {}
- data ReaderT r (m :: Type -> Type) a
- data StateT s (m :: Type -> Type) a
- bracketSet :: (MonadMask m, MonadIO m) => IO a -> (a -> IO ()) -> a -> m b -> m b
- clearLine :: Term m => LineChars -> m ()
- drawLine :: Term m => LineChars -> m ()
- flushEventQueue :: (String -> IO ()) -> TChan Event -> IO ()
- guardedEOF :: (Handle -> IO a) -> Handle -> MaybeT IO a
- hGetByte :: Handle -> MaybeT IO Word8
- hGetLocaleLine :: Handle -> MaybeT IO ByteString
- hMaybeReadNewline :: Handle -> IO ()
- hWithBinaryMode :: (MonadIO m, MonadMask m) => Handle -> m a -> m a
- isTerminalStyle :: RunTerm -> Bool
- keyEventLoop :: IO [Event] -> TChan Event -> IO Event
- mapEvalTerm :: (forall a. n a -> m a) -> (forall a. m a -> n a) -> EvalTerm n -> EvalTerm m
- matchInit :: Eq a => [a] -> [a] -> ([a], [a])
- returnOnEOF :: MonadMask m => a -> m a -> m a
- saveKeys :: TChan Event -> [Key] -> IO ()
- class (MonadReader Prefs m, MonadReader Layout m, MonadIO m, MonadMask m) => CommandMonad (m :: Type -> Type) where
- runCompletion :: (String, String) -> m (String, [Completion])
- data EvalTerm (m :: Type -> Type) = (Term n, CommandMonad n) => EvalTerm (forall a. n a -> m a) (forall a. m a -> n a)
- data Event
- data FileOps = FileOps {
- withoutInputEcho :: forall m a. (MonadIO m, MonadMask m) => m a -> m a
- wrapFileInput :: forall a. IO a -> IO a
- getLocaleLine :: MaybeT IO String
- getLocaleChar :: MaybeT IO Char
- maybeReadNewline :: IO ()
- data Interrupt = Interrupt
- data Layout = Layout {}
- data RunTerm = RunTerm {}
- class (MonadReader Layout m, MonadIO m, MonadMask m) => Term (m :: Type -> Type) where
- reposition :: Layout -> LineChars -> m ()
- moveToNextLine :: LineChars -> m ()
- printLines :: [String] -> m ()
- drawLineDiff :: LineChars -> LineChars -> m ()
- clearLayout :: m ()
- ringBell :: Bool -> m ()
- data TermOps = TermOps {
- getLayout :: IO Layout
- withGetEvent :: forall m a. CommandMonad m => (m Event -> m a) -> m a
- evalTerm :: forall m. CommandMonad m => EvalTerm m
- saveUnusedKeys :: [Key] -> IO ()
- externalPrint :: String -> IO ()
- ctrlChar :: Char -> Key
- ctrlKey :: Key -> Key
- metaChar :: Char -> Key
- metaKey :: Key -> Key
- noModifier :: Modifier
- parseKey :: String -> Maybe Key
- setControlBits :: Char -> Char
- simpleChar :: Char -> Key
- simpleKey :: BaseKey -> Key
- data BaseKey
- data Key = Key Modifier BaseKey
- data Modifier = Modifier {}
- addNum :: Int -> ArgMode s -> ArgMode s
- addPasswordChar :: Char -> Password -> Password
- afterChar :: (Char -> Bool) -> InsertMode -> Bool
- appendFromCommandMode :: CommandMode -> InsertMode
- applyArg :: (s -> s) -> ArgMode s -> s
- applyCmdArg :: (InsertMode -> InsertMode) -> ArgMode CommandMode -> CommandMode
- atEnd :: (Char -> Bool) -> InsertMode -> Bool
- atStart :: (Char -> Bool) -> InsertMode -> Bool
- baseChar :: Grapheme -> Char
- beforeChar :: (Char -> Bool) -> InsertMode -> Bool
- deleteChar :: CommandMode -> CommandMode
- deleteNext :: InsertMode -> InsertMode
- deletePasswordChar :: Password -> Password
- deletePrev :: InsertMode -> InsertMode
- emptyIM :: InsertMode
- enterCommandMode :: InsertMode -> CommandMode
- enterCommandModeRight :: InsertMode -> CommandMode
- goLeftUntil :: (InsertMode -> Bool) -> InsertMode -> InsertMode
- goRightUntil :: (InsertMode -> Bool) -> InsertMode -> InsertMode
- graphemesToString :: [Grapheme] -> String
- insertChar :: Char -> InsertMode -> InsertMode
- insertFromCommandMode :: CommandMode -> InsertMode
- insertGraphemes :: [Grapheme] -> InsertMode -> InsertMode
- insertString :: String -> InsertMode -> InsertMode
- lengthToEnd :: LineChars -> Int
- lineChars :: LineState s => Prefix -> s -> LineChars
- listRestore :: Save s => [Grapheme] -> s
- listSave :: Save s => s -> [Grapheme]
- mapBaseChars :: (Char -> Char) -> [Grapheme] -> [Grapheme]
- modifyBaseChar :: (Char -> Char) -> Grapheme -> Grapheme
- overChar :: (Char -> Bool) -> InsertMode -> Bool
- pasteGraphemesAfter :: [Grapheme] -> CommandMode -> CommandMode
- pasteGraphemesBefore :: [Grapheme] -> CommandMode -> CommandMode
- replaceChar :: Char -> CommandMode -> CommandMode
- replaceCharIM :: Char -> InsertMode -> InsertMode
- skipLeft :: (Char -> Bool) -> InsertMode -> InsertMode
- skipRight :: (Char -> Bool) -> InsertMode -> InsertMode
- startArg :: Int -> s -> ArgMode s
- stringToGraphemes :: String -> [Grapheme]
- transposeChars :: InsertMode -> InsertMode
- withCommandMode :: (InsertMode -> InsertMode) -> CommandMode -> CommandMode
- data ArgMode s = ArgMode {}
- data CommandMode
- data Grapheme
- data InsertMode = IMode [Grapheme] [Grapheme]
- type LineChars = ([Grapheme], [Grapheme])
- class LineState s where
- beforeCursor :: Prefix -> s -> [Grapheme]
- afterCursor :: s -> [Grapheme]
- newtype Message = Message {}
- class Move s where
- goLeft :: s -> s
- goRight :: s -> s
- moveToStart :: s -> s
- moveToEnd :: s -> s
- data Password = Password {
- passwordState :: [Char]
- passwordChar :: Maybe Char
- type Prefix = [Grapheme]
- class LineState s => Result s where
- class LineState s => Save s where
- save :: s -> InsertMode
- restore :: InsertMode -> s
- data Behavior = Behavior (IO RunTerm)
- debugTerminalKeys :: IO a
Documentation
asks :: MonadReader r m => (r -> a) -> m a Source #
evalStateT' :: Monad m => s -> StateT s m a -> m a Source #
gets :: MonadState s m => (s -> a) -> m a Source #
modify :: MonadState s m => (s -> s) -> m () Source #
runReaderT' :: r -> ReaderT r m a -> m a Source #
update :: MonadState s m => (s -> (a, s)) -> m a Source #
mapReaderT :: (m a -> n b) -> ReaderT r m a -> ReaderT r n b Source #
Transform the computation inside a ReaderT.
runReaderT(mapReaderTf m) = f .runReaderTm
class Monad m => MonadIO (m :: Type -> Type) where #
Instances
class Monad m => MonadReader r (m :: Type -> Type) where Source #
Instances
| (MonadReader r m, MonadTrans t, Monad (t m)) => MonadReader r (t m) Source # | |
Defined in System.Console.Haskeline.Monads | |
| Monad m => MonadReader r (ReaderT r m) Source # | |
Defined in System.Console.Haskeline.Monads | |
| Monad m => MonadReader s (StateT s m) Source # | |
Defined in System.Console.Haskeline.Monads | |
class Monad m => MonadState s (m :: Type -> Type) where Source #
Instances
| (MonadState s m, MonadTrans t, Monad (t m)) => MonadState s (t m) Source # | |
| MonadIO m => MonadState s (ReaderT (IORef s) m) Source # | |
| Monad m => MonadState s (StateT s m) Source # | |
class (forall m. Monad m => Monad (t m)) => MonadTrans (t :: (Type -> Type) -> Type -> Type) where Source #
The class of monad transformers.
For any monad m, the result t m should also be a monad,
and lift should be a monad transformation from m to t m,
i.e. it should satisfy the following laws:
Since 0.6.0.0 and for GHC 8.6 and later, the requirement that t m
be a Monad is enforced by the implication constraint
forall m. enabled by the
Monad m => Monad (t m)QuantifiedConstraints extension.
Ambiguity error with GHC 9.0 to 9.2.2
These versions of GHC have a bug (https://gitlab.haskell.org/ghc/ghc/-/issues/20582) which causes constraints like
(MonadTrans t, forall m. Monad m => Monad (t m)) => ...
to be reported as ambiguous. For transformers 0.6 and later, this can be fixed by removing the second constraint, which is implied by the first.
Methods
lift :: Monad m => m a -> t m a Source #
Lift a computation from the argument monad to the constructed monad.
Instances
| MonadTrans CatchT Source # | |
| MonadTrans InputT Source # | |
| MonadTrans MaybeT Source # | |
| Monoid w => MonadTrans (AccumT w) Source # | |
| MonadTrans (ExceptT e) Source # | |
| MonadTrans (IdentityT :: (Type -> Type) -> Type -> Type) Source # | |
| MonadTrans (ReaderT r) Source # | |
| MonadTrans (SelectT r) Source # | |
| MonadTrans (StateT s) Source # | |
| MonadTrans (StateT s) Source # | |
| MonadTrans (WriterT w) Source # | |
| Monoid w => MonadTrans (WriterT w) Source # | |
| Monoid w => MonadTrans (WriterT w) Source # | |
| MonadTrans (ContT r) Source # | |
| MonadTrans (RWST r w s) Source # | |
| Monoid w => MonadTrans (RWST r w s) Source # | |
| Monoid w => MonadTrans (RWST r w s) Source # | |
newtype MaybeT (m :: Type -> Type) a Source #
The parameterizable maybe monad, a strict monad obtained by composing
an arbitrary monad with the Maybe monad.
Computations are actions that may produce a value or exit.
The return function yields a computation that produces that
value, while >>= sequences two subcomputations, exiting if either
computation does.
Instances
data ReaderT r (m :: Type -> Type) a Source #
The reader monad transformer, which adds a read-only environment to the given monad.
The return function ignores the environment, while m
passes the inherited environment to both subcomputations:>>= k
ReaderT r m is strict if and only if m is.
Instances
| Generic1 (ReaderT r m :: Type -> Type) Source # | |||||
Defined in Control.Monad.Trans.Reader Associated Types
| |||||
| Monad m => MonadReader r (ReaderT r m) Source # | |||||
Defined in System.Console.Haskeline.Monads | |||||
| MonadIO m => MonadState s (ReaderT (IORef s) m) Source # | |||||
| MonadTrans (ReaderT r) Source # | |||||
| Contravariant m => Contravariant (ReaderT r m) Source # | |||||
| MonadCatch m => MonadCatch (ReaderT r m) Source # | |||||
Defined in Control.Monad.Catch | |||||
| MonadMask m => MonadMask (ReaderT r m) Source # | |||||
Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. ReaderT r m a -> ReaderT r m a) -> ReaderT r m b) -> ReaderT r m b Source # uninterruptibleMask :: HasCallStack => ((forall a. ReaderT r m a -> ReaderT r m a) -> ReaderT r m b) -> ReaderT r m b Source # generalBracket :: HasCallStack => ReaderT r m a -> (a -> ExitCase b -> ReaderT r m c) -> (a -> ReaderT r m b) -> ReaderT r m (b, c) Source # | |||||
| MonadThrow m => MonadThrow (ReaderT r m) Source # | |||||
Defined in Control.Monad.Catch | |||||
| Alternative m => Alternative (ReaderT r m) Source # | |||||
| Applicative m => Applicative (ReaderT r m) Source # | |||||
Defined in Control.Monad.Trans.Reader | |||||
| Functor m => Functor (ReaderT r m) Source # | |||||
| Monad m => Monad (ReaderT r m) Source # | |||||
| MonadPlus m => MonadPlus (ReaderT r m) Source # | |||||
| MonadFail m => MonadFail (ReaderT r m) Source # | |||||
Defined in Control.Monad.Trans.Reader Methods fail :: HasCallStack => String -> ReaderT r m a # | |||||
| MonadFix m => MonadFix (ReaderT r m) Source # | |||||
Defined in Control.Monad.Trans.Reader | |||||
| MonadIO m => MonadIO (ReaderT r m) Source # | |||||
Defined in Control.Monad.Trans.Reader | |||||
| MonadZip m => MonadZip (ReaderT r m) Source # | |||||
| Generic (ReaderT r m a) Source # | |||||
Defined in Control.Monad.Trans.Reader Associated Types
| |||||
| type Rep1 (ReaderT r m :: Type -> Type) Source # | |||||
Defined in Control.Monad.Trans.Reader type Rep1 (ReaderT r m :: Type -> Type) = D1 ('MetaData "ReaderT" "Control.Monad.Trans.Reader" "transformers-0.6.3.0-46d5" 'True) (C1 ('MetaCons "ReaderT" 'PrefixI 'True) (S1 ('MetaSel ('Just "runReaderT") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) ((FUN 'Many r :: Type -> Type) :.: Rec1 m))) | |||||
| type Rep (ReaderT r m a) Source # | |||||
Defined in Control.Monad.Trans.Reader | |||||
data StateT s (m :: Type -> Type) a Source #
A state transformer monad parameterized by:
s- The state.m- The inner monad.
The return function leaves the state unchanged, while >>= uses
the final state of the first computation as the initial state of
the second.
Instances
| Monad m => MonadReader s (StateT s m) Source # | |||||
Defined in System.Console.Haskeline.Monads | |||||
| Monad m => MonadState s (StateT s m) Source # | |||||
| MonadTrans (StateT s) Source # | |||||
| Contravariant m => Contravariant (StateT s m) Source # | |||||
| MonadCatch m => MonadCatch (StateT s m) Source # | |||||
Defined in Control.Monad.Catch | |||||
| MonadMask m => MonadMask (StateT s m) Source # | |||||
Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b Source # uninterruptibleMask :: HasCallStack => ((forall a. StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b Source # generalBracket :: HasCallStack => StateT s m a -> (a -> ExitCase b -> StateT s m c) -> (a -> StateT s m b) -> StateT s m (b, c) Source # | |||||
| MonadThrow m => MonadThrow (StateT s m) Source # | |||||
Defined in Control.Monad.Catch | |||||
| (Functor m, MonadPlus m) => Alternative (StateT s m) Source # | |||||
| (Functor m, Monad m) => Applicative (StateT s m) Source # | |||||
Defined in Control.Monad.Trans.State.Strict | |||||
| Functor m => Functor (StateT s m) Source # | |||||
| Monad m => Monad (StateT s m) Source # | |||||
| MonadPlus m => MonadPlus (StateT s m) Source # | |||||
| MonadFail m => MonadFail (StateT s m) Source # | |||||
Defined in Control.Monad.Trans.State.Strict Methods fail :: HasCallStack => String -> StateT s m a # | |||||
| MonadFix m => MonadFix (StateT s m) Source # | |||||
Defined in Control.Monad.Trans.State.Strict | |||||
| MonadIO m => MonadIO (StateT s m) Source # | |||||
Defined in Control.Monad.Trans.State.Strict | |||||
| Generic (StateT s m a) Source # | |||||
Defined in Control.Monad.Trans.State.Strict Associated Types
| |||||
| type Rep (StateT s m a) Source # | |||||
Defined in Control.Monad.Trans.State.Strict | |||||
bracketSet :: (MonadMask m, MonadIO m) => IO a -> (a -> IO ()) -> a -> m b -> m b Source #
Utility function for changing a property of a terminal for the duration of a computation.
hGetByte :: Handle -> MaybeT IO Word8 Source #
Returns one 8-bit word. Needs to be wrapped by hWithBinaryMode.
hGetLocaleLine :: Handle -> MaybeT IO ByteString Source #
Utility function to correctly get a line of input as an undecoded ByteString.
hMaybeReadNewline :: Handle -> IO () Source #
hWithBinaryMode :: (MonadIO m, MonadMask m) => Handle -> m a -> m a Source #
Utility function since we're not using the new IO library yet.
isTerminalStyle :: RunTerm -> Bool Source #
Are we using terminal-style interaction?
mapEvalTerm :: (forall a. n a -> m a) -> (forall a. m a -> n a) -> EvalTerm n -> EvalTerm m Source #
returnOnEOF :: MonadMask m => a -> m a -> m a Source #
class (MonadReader Prefs m, MonadReader Layout m, MonadIO m, MonadMask m) => CommandMonad (m :: Type -> Type) where Source #
Methods
runCompletion :: (String, String) -> m (String, [Completion]) Source #
Instances
| (MonadTrans t, CommandMonad m, MonadReader Prefs (t m), MonadIO (t m), MonadMask (t m), MonadReader Layout (t m)) => CommandMonad (t m) Source # | |
Defined in System.Console.Haskeline.Term Methods runCompletion :: (String, String) -> t m (String, [Completion]) Source # | |
data EvalTerm (m :: Type -> Type) Source #
Constructors
| (Term n, CommandMonad n) => EvalTerm (forall a. n a -> m a) (forall a. m a -> n a) |
Constructors
| WindowResize | |
| KeyInput [Key] | |
| ErrorEvent SomeException | |
| ExternalPrint String |
Operations needed for file-style interaction.
Backends can assume that getLocaleLine, getLocaleChar and maybeReadNewline are "wrapped" by wrapFileInput.
Constructors
| FileOps | |
Fields
| |
Constructors
| Interrupt |
Instances
| Eq Interrupt Source # | |
| Exception Interrupt Source # | |
Defined in System.Console.Haskeline.Term Methods toException :: Interrupt -> SomeException # fromException :: SomeException -> Maybe Interrupt # displayException :: Interrupt -> String # backtraceDesired :: Interrupt -> Bool # | |
| Show Interrupt Source # | |
Instances
class (MonadReader Layout m, MonadIO m, MonadMask m) => Term (m :: Type -> Type) where Source #
Methods
reposition :: Layout -> LineChars -> m () Source #
moveToNextLine :: LineChars -> m () Source #
printLines :: [String] -> m () Source #
drawLineDiff :: LineChars -> LineChars -> m () Source #
clearLayout :: m () Source #
Operations needed for terminal-style interaction.
Constructors
| TermOps | |
Fields
| |
setControlBits :: Char -> Char Source #
simpleChar :: Char -> Key Source #
Constructors
| KeyChar Char | |
| FunKey Int | |
| LeftKey | |
| RightKey | |
| DownKey | |
| UpKey | |
| KillLine | |
| Home | |
| End | |
| PageDown | |
| PageUp | |
| Backspace | |
| Delete | |
| SearchReverse | |
| SearchForward |
applyCmdArg :: (InsertMode -> InsertMode) -> ArgMode CommandMode -> CommandMode Source #
beforeChar :: (Char -> Bool) -> InsertMode -> Bool Source #
deleteChar :: CommandMode -> CommandMode Source #
deleteNext :: InsertMode -> InsertMode Source #
deletePrev :: InsertMode -> InsertMode Source #
emptyIM :: InsertMode Source #
goLeftUntil :: (InsertMode -> Bool) -> InsertMode -> InsertMode Source #
goRightUntil :: (InsertMode -> Bool) -> InsertMode -> InsertMode Source #
graphemesToString :: [Grapheme] -> String Source #
insertChar :: Char -> InsertMode -> InsertMode Source #
Insert one character, which may be combining, to the left of the cursor.
insertGraphemes :: [Grapheme] -> InsertMode -> InsertMode Source #
insertString :: String -> InsertMode -> InsertMode Source #
Insert a sequence of characters to the left of the cursor.
lengthToEnd :: LineChars -> Int Source #
Compute the number of characters under and to the right of the cursor.
lineChars :: LineState s => Prefix -> s -> LineChars Source #
Accessor function for the various backends.
listRestore :: Save s => [Grapheme] -> s Source #
pasteGraphemesAfter :: [Grapheme] -> CommandMode -> CommandMode Source #
pasteGraphemesBefore :: [Grapheme] -> CommandMode -> CommandMode Source #
replaceChar :: Char -> CommandMode -> CommandMode Source #
replaceCharIM :: Char -> InsertMode -> InsertMode Source #
skipLeft :: (Char -> Bool) -> InsertMode -> InsertMode Source #
skipRight :: (Char -> Bool) -> InsertMode -> InsertMode Source #
stringToGraphemes :: String -> [Grapheme] Source #
Converts a string into a sequence of graphemes.
NOTE: Drops any initial, unattached combining characters.
withCommandMode :: (InsertMode -> InsertMode) -> CommandMode -> CommandMode Source #
Used for commands which take an integer argument.
data CommandMode Source #
Used by vi mode. Considers the cursor to be located over some specific character. The first list is reversed.
Instances
| Show CommandMode Source # | |
Defined in System.Console.Haskeline.LineState Methods showsPrec :: Int -> CommandMode -> ShowS # show :: CommandMode -> String # showList :: [CommandMode] -> ShowS # | |
| LineState CommandMode Source # | |
Defined in System.Console.Haskeline.LineState Methods beforeCursor :: Prefix -> CommandMode -> [Grapheme] Source # afterCursor :: CommandMode -> [Grapheme] Source # | |
| Move CommandMode Source # | |
Defined in System.Console.Haskeline.LineState Methods goLeft :: CommandMode -> CommandMode Source # goRight :: CommandMode -> CommandMode Source # moveToStart :: CommandMode -> CommandMode Source # moveToEnd :: CommandMode -> CommandMode Source # | |
| Result CommandMode Source # | |
Defined in System.Console.Haskeline.LineState Methods toResult :: CommandMode -> String Source # | |
| Save CommandMode Source # | |
Defined in System.Console.Haskeline.LineState | |
A Grapheme is a fundamental unit of display for the UI. Several characters in sequence
can represent one grapheme; for example, an a followed by the diacritic '\768' should
be treated as one unit.
data InsertMode Source #
The standard line state representation; considers the cursor to be located between two characters. The first list is reversed.
Instances
| Eq InsertMode Source # | |
Defined in System.Console.Haskeline.LineState | |
| Show InsertMode Source # | |
Defined in System.Console.Haskeline.LineState Methods showsPrec :: Int -> InsertMode -> ShowS # show :: InsertMode -> String # showList :: [InsertMode] -> ShowS # | |
| LineState InsertMode Source # | |
Defined in System.Console.Haskeline.LineState Methods beforeCursor :: Prefix -> InsertMode -> [Grapheme] Source # afterCursor :: InsertMode -> [Grapheme] Source # | |
| Move InsertMode Source # | |
Defined in System.Console.Haskeline.LineState Methods goLeft :: InsertMode -> InsertMode Source # goRight :: InsertMode -> InsertMode Source # moveToStart :: InsertMode -> InsertMode Source # moveToEnd :: InsertMode -> InsertMode Source # | |
| Result InsertMode Source # | |
Defined in System.Console.Haskeline.LineState Methods toResult :: InsertMode -> String Source # | |
| Save InsertMode Source # | |
Defined in System.Console.Haskeline.LineState | |
type LineChars = ([Grapheme], [Grapheme]) Source #
The characters in the line (with the cursor in the middle). NOT in a zippered format; both lists are in the order left->right that appears on the screen.
class LineState s where Source #
This class abstracts away the internal representations of the line state, for use by the drawing actions. Line state is generally stored in a zipper format.
Methods
Arguments
| :: Prefix | The input prefix. |
| -> s | The current line state. |
| -> [Grapheme] | The text to the left of the cursor (including the prefix). |
Arguments
| :: s | |
| -> [Grapheme] | The text under and to the right of the cursor. |
Instances
| LineState CommandMode Source # | |
Defined in System.Console.Haskeline.LineState Methods beforeCursor :: Prefix -> CommandMode -> [Grapheme] Source # afterCursor :: CommandMode -> [Grapheme] Source # | |
| LineState InsertMode Source # | |
Defined in System.Console.Haskeline.LineState Methods beforeCursor :: Prefix -> InsertMode -> [Grapheme] Source # afterCursor :: InsertMode -> [Grapheme] Source # | |
| LineState Message Source # | |
Defined in System.Console.Haskeline.LineState | |
| LineState Password Source # | |
Defined in System.Console.Haskeline.LineState | |
| LineState s => LineState (ArgMode s) Source # | |
Defined in System.Console.Haskeline.LineState | |
Constructors
| Message | |
Fields | |
Methods
moveToStart :: s -> s Source #
Instances
| Move CommandMode Source # | |
Defined in System.Console.Haskeline.LineState Methods goLeft :: CommandMode -> CommandMode Source # goRight :: CommandMode -> CommandMode Source # moveToStart :: CommandMode -> CommandMode Source # moveToEnd :: CommandMode -> CommandMode Source # | |
| Move InsertMode Source # | |
Defined in System.Console.Haskeline.LineState Methods goLeft :: InsertMode -> InsertMode Source # goRight :: InsertMode -> InsertMode Source # moveToStart :: InsertMode -> InsertMode Source # moveToEnd :: InsertMode -> InsertMode Source # | |
Constructors
| Password | |
Fields
| |
class LineState s => Result s where Source #
Instances
| Result CommandMode Source # | |
Defined in System.Console.Haskeline.LineState Methods toResult :: CommandMode -> String Source # | |
| Result InsertMode Source # | |
Defined in System.Console.Haskeline.LineState Methods toResult :: InsertMode -> String Source # | |
| Result Password Source # | |
| Result s => Result (ArgMode s) Source # | |
class LineState s => Save s where Source #
Instances
| Save CommandMode Source # | |
Defined in System.Console.Haskeline.LineState | |
| Save InsertMode Source # | |
Defined in System.Console.Haskeline.LineState | |
| Save s => Save (ArgMode s) Source # | |
Defined in System.Console.Haskeline.LineState | |
Haskeline has two ways of interacting with the user:
- "Terminal-style" interaction provides an rich user interface by connecting
to the user's terminal (which may be different than
stdinorstdout). - "File-style" interaction treats the input as a simple stream of characters, for example
when reading from a file or pipe. Input functions (e.g.,
getInputLine) print the prompt tostdout.
A Behavior is a method for deciding at run-time which type of interaction to use.
For most applications (e.g., a REPL), defaultBehavior should have the correct effect.
debugTerminalKeys :: IO a Source #
This function may be used to debug Haskeline's input.
It loops indefinitely; every time a key is pressed, it will print that key as it was recognized by Haskeline. Pressing Ctrl-C will stop the loop.
Haskeline's behavior may be modified by editing your ~/.haskeline
file. For details, see: https://github.com/judah/haskeline/wiki/CustomKeyBindings