| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
System.Console.Haskeline.Internal
Description
A module containing semi-public internals. The functions here are not stable.
Synopsis
- class Monad m => MonadState s (m :: Type -> Type) where
- class (forall (m :: Type -> Type). Monad m => Monad (t m)) => MonadTrans (t :: (Type -> Type) -> Type -> Type) where
- class Monad m => MonadIO (m :: Type -> Type) where
- orElse :: Monad m => MaybeT m a -> m a -> m a
- update :: MonadState s m => (s -> (a, s)) -> m a
- newtype MaybeT (m :: Type -> Type) a = MaybeT {}
- data StateT s (m :: Type -> Type) a
- data ReaderT r (m :: Type -> Type) 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 => MonadReader r (m :: Type -> Type) where
- ask :: m r
- asks :: MonadReader r m => (r -> a) -> m a
- modify :: MonadState s m => (s -> s) -> m ()
- gets :: MonadState s m => (s -> a) -> m a
- runReaderT' :: r -> ReaderT r m a -> m a
- evalStateT' :: Monad m => s -> StateT s m a -> m a
- 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 Event
- data Interrupt = Interrupt
- data RunTerm = RunTerm {}
- data Layout = Layout {}
- 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)
- drawLine :: Term m => LineChars -> m ()
- clearLine :: Term m => LineChars -> m ()
- data TermOps = TermOps {
- getLayout :: IO Layout
- withGetEvent :: forall (m :: Type -> Type) a. CommandMonad m => (m Event -> m a) -> m a
- evalTerm :: forall (m :: Type -> Type). CommandMonad m => EvalTerm m
- saveUnusedKeys :: [Key] -> IO ()
- externalPrint :: String -> IO ()
- data FileOps = FileOps {
- withoutInputEcho :: forall (m :: Type -> Type) 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 ()
- flushEventQueue :: (String -> IO ()) -> TChan Event -> IO ()
- isTerminalStyle :: RunTerm -> Bool
- mapEvalTerm :: (forall a. n a -> m a) -> (forall a. m a -> n a) -> EvalTerm n -> EvalTerm m
- matchInit :: Eq a => [a] -> [a] -> ([a], [a])
- keyEventLoop :: IO [Event] -> TChan Event -> IO Event
- saveKeys :: TChan Event -> [Key] -> IO ()
- hWithBinaryMode :: (MonadIO m, MonadMask m) => Handle -> m a -> m a
- bracketSet :: (MonadMask m, MonadIO m) => IO a -> (a -> IO ()) -> a -> m b -> m b
- hGetByte :: Handle -> MaybeT IO Word8
- guardedEOF :: (Handle -> IO a) -> Handle -> MaybeT IO a
- hMaybeReadNewline :: Handle -> IO ()
- returnOnEOF :: MonadMask m => a -> m a -> m a
- hGetLocaleLine :: Handle -> MaybeT IO ByteString
- data Key = Key Modifier BaseKey
- data Modifier = Modifier {}
- data BaseKey
- noModifier :: Modifier
- simpleKey :: BaseKey -> Key
- simpleChar :: Char -> Key
- metaChar :: Char -> Key
- ctrlChar :: Char -> Key
- metaKey :: Key -> Key
- ctrlKey :: Key -> Key
- parseKey :: String -> Maybe Key
- setControlBits :: Char -> Char
- type Prefix = [Grapheme]
- data CommandMode
- class LineState s => Result s where
- class LineState s where
- beforeCursor :: Prefix -> s -> [Grapheme]
- afterCursor :: s -> [Grapheme]
- data Grapheme
- baseChar :: Grapheme -> Char
- stringToGraphemes :: String -> [Grapheme]
- graphemesToString :: [Grapheme] -> String
- modifyBaseChar :: (Char -> Char) -> Grapheme -> Grapheme
- mapBaseChars :: (Char -> Char) -> [Grapheme] -> [Grapheme]
- type LineChars = ([Grapheme], [Grapheme])
- lineChars :: LineState s => Prefix -> s -> LineChars
- lengthToEnd :: LineChars -> Int
- class LineState s => Save s where
- save :: s -> InsertMode
- restore :: InsertMode -> s
- listSave :: Save s => s -> [Grapheme]
- listRestore :: Save s => [Grapheme] -> s
- class Move s where
- goLeft :: s -> s
- goRight :: s -> s
- moveToStart :: s -> s
- moveToEnd :: s -> s
- data InsertMode = IMode [Grapheme] [Grapheme]
- emptyIM :: InsertMode
- insertChar :: Char -> InsertMode -> InsertMode
- insertString :: String -> InsertMode -> InsertMode
- replaceCharIM :: Char -> InsertMode -> InsertMode
- insertGraphemes :: [Grapheme] -> InsertMode -> InsertMode
- deleteNext :: InsertMode -> InsertMode
- deletePrev :: InsertMode -> InsertMode
- skipLeft :: (Char -> Bool) -> InsertMode -> InsertMode
- skipRight :: (Char -> Bool) -> InsertMode -> InsertMode
- transposeChars :: InsertMode -> InsertMode
- goRightUntil :: (InsertMode -> Bool) -> InsertMode -> InsertMode
- goLeftUntil :: (InsertMode -> Bool) -> InsertMode -> InsertMode
- atStart :: (Char -> Bool) -> InsertMode -> Bool
- atEnd :: (Char -> Bool) -> InsertMode -> Bool
- beforeChar :: (Char -> Bool) -> InsertMode -> Bool
- afterChar :: (Char -> Bool) -> InsertMode -> Bool
- overChar :: (Char -> Bool) -> InsertMode -> Bool
- deleteChar :: CommandMode -> CommandMode
- replaceChar :: Char -> CommandMode -> CommandMode
- pasteGraphemesBefore :: [Grapheme] -> CommandMode -> CommandMode
- pasteGraphemesAfter :: [Grapheme] -> CommandMode -> CommandMode
- enterCommandMode :: InsertMode -> CommandMode
- enterCommandModeRight :: InsertMode -> CommandMode
- insertFromCommandMode :: CommandMode -> InsertMode
- appendFromCommandMode :: CommandMode -> InsertMode
- withCommandMode :: (InsertMode -> InsertMode) -> CommandMode -> CommandMode
- data ArgMode s = ArgMode {}
- startArg :: Int -> s -> ArgMode s
- addNum :: Int -> ArgMode s -> ArgMode s
- applyArg :: (s -> s) -> ArgMode s -> s
- applyCmdArg :: (InsertMode -> InsertMode) -> ArgMode CommandMode -> CommandMode
- newtype Message = Message {}
- data Password = Password {
- passwordState :: [Char]
- passwordChar :: Maybe Char
- addPasswordChar :: Char -> Password -> Password
- deletePasswordChar :: Password -> Password
- data Behavior = Behavior (IO RunTerm)
- debugTerminalKeys :: IO a
Documentation
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 :: Type -> Type). Monad m => Monad (t m)) => MonadTrans (t :: (Type -> Type) -> Type -> Type) where #
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 #
Lift a computation from the argument monad to the constructed monad.
Instances
class Monad m => MonadIO (m :: Type -> Type) where #
Monads in which IO computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
IO monad will be an instance of this class.
Instances should satisfy the following laws, which state that liftIO
is a transformer of monads:
Methods
Lift a computation from the IO monad.
This allows us to run IO computations in any monadic stack, so long as it supports these kinds of operations
(i.e. IO is the base monad for the stack).
Example
import Control.Monad.Trans.State -- from the "transformers" library printState :: Show s => StateT s IO () printState = do state <- get liftIO $ print state
Had we omitted , we would have ended up with this error:liftIO
• Couldn't match type ‘IO’ with ‘StateT s IO’ Expected type: StateT s IO () Actual type: IO ()
The important part here is the mismatch between StateT s IO () and .IO ()
Luckily, we know of a function that takes an and returns an IO a(m a): ,
enabling us to run the program and see the expected results:liftIO
> evalStateT printState "hello" "hello" > evalStateT printState 3 3
Instances
update :: MonadState s m => (s -> (a, s)) -> m a Source #
newtype MaybeT (m :: Type -> Type) a #
The parameterizable maybe 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 StateT s (m :: Type -> Type) a #
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) | |||||
Defined in Control.Monad.Trans.State.Strict | |||||
| MonadIO m => MonadIO (StateT s m) | |||||
Defined in Control.Monad.Trans.State.Strict | |||||
| Contravariant m => Contravariant (StateT s m) | |||||
| MonadCatch m => MonadCatch (StateT s m) | |||||
Defined in Control.Monad.Catch | |||||
| MonadMask m => MonadMask (StateT s m) | |||||
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 # uninterruptibleMask :: HasCallStack => ((forall a. StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b # generalBracket :: HasCallStack => StateT s m a -> (a -> ExitCase b -> StateT s m c) -> (a -> StateT s m b) -> StateT s m (b, c) # | |||||
| MonadThrow m => MonadThrow (StateT s m) | |||||
Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> StateT s m a # | |||||
| (Functor m, MonadPlus m) => Alternative (StateT s m) | |||||
| (Functor m, Monad m) => Applicative (StateT s m) | |||||
Defined in Control.Monad.Trans.State.Strict | |||||
| Functor m => Functor (StateT s m) | |||||
| Monad m => Monad (StateT s m) | |||||
| MonadPlus m => MonadPlus (StateT s m) | |||||
| MonadFail m => MonadFail (StateT s m) | |||||
Defined in Control.Monad.Trans.State.Strict | |||||
| MonadFix m => MonadFix (StateT s m) | |||||
Defined in Control.Monad.Trans.State.Strict | |||||
| Generic (StateT s m a) | |||||
Defined in Control.Monad.Trans.State.Strict Associated Types
| |||||
| type Rep (StateT s m a) | |||||
Defined in Control.Monad.Trans.State.Strict | |||||
data ReaderT r (m :: Type -> Type) a #
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
Instances
| Generic1 (ReaderT r m :: Type -> Type) | |||||
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) | |||||
Defined in Control.Monad.Trans.Reader | |||||
| MonadIO m => MonadIO (ReaderT r m) | |||||
Defined in Control.Monad.Trans.Reader | |||||
| MonadZip m => MonadZip (ReaderT r m) | |||||
| Contravariant m => Contravariant (ReaderT r m) | |||||
| MonadCatch m => MonadCatch (ReaderT r m) | |||||
Defined in Control.Monad.Catch | |||||
| MonadMask m => MonadMask (ReaderT r m) | |||||
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 # uninterruptibleMask :: HasCallStack => ((forall a. ReaderT r m a -> ReaderT r m a) -> ReaderT r m b) -> ReaderT r m b # generalBracket :: HasCallStack => ReaderT r m a -> (a -> ExitCase b -> ReaderT r m c) -> (a -> ReaderT r m b) -> ReaderT r m (b, c) # | |||||
| MonadThrow m => MonadThrow (ReaderT r m) | |||||
Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> ReaderT r m a # | |||||
| Alternative m => Alternative (ReaderT r m) | |||||
| Applicative m => Applicative (ReaderT r m) | |||||
Defined in Control.Monad.Trans.Reader | |||||
| Functor m => Functor (ReaderT r m) | |||||
| Monad m => Monad (ReaderT r m) | |||||
| MonadPlus m => MonadPlus (ReaderT r m) | |||||
| MonadFail m => MonadFail (ReaderT r m) | |||||
Defined in Control.Monad.Trans.Reader | |||||
| MonadFix m => MonadFix (ReaderT r m) | |||||
Defined in Control.Monad.Trans.Reader | |||||
| Generic (ReaderT r m a) | |||||
Defined in Control.Monad.Trans.Reader Associated Types
| |||||
| type Rep1 (ReaderT r m :: Type -> Type) | |||||
Defined in Control.Monad.Trans.Reader type Rep1 (ReaderT r m :: Type -> Type) = D1 ('MetaData "ReaderT" "Control.Monad.Trans.Reader" "transformers-0.6.1.1-c721" '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) | |||||
Defined in Control.Monad.Trans.Reader | |||||
mapReaderT :: (m a -> n b) -> ReaderT r m a -> ReaderT r n b #
Transform the computation inside a ReaderT.
runReaderT(mapReaderTf m) = f .runReaderTm
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 | |
asks :: MonadReader r m => (r -> a) -> m a Source #
modify :: MonadState s m => (s -> s) -> m () Source #
gets :: MonadState s m => (s -> a) -> m a Source #
runReaderT' :: r -> ReaderT r m a -> m a Source #
evalStateT' :: Monad m => s -> StateT s m a -> m a Source #
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 #
Constructors
| WindowResize | |
| KeyInput [Key] | |
| ErrorEvent SomeException | |
| ExternalPrint String |
Constructors
| Interrupt |
Instances
| 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 # | |
| Eq Interrupt Source # | |
Instances
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) |
Operations needed for terminal-style interaction.
Constructors
| TermOps | |
Fields
| |
Operations needed for file-style interaction.
Backends can assume that getLocaleLine, getLocaleChar and maybeReadNewline are "wrapped" by wrapFileInput.
Constructors
| FileOps | |
Fields
| |
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 #
hWithBinaryMode :: (MonadIO m, MonadMask m) => Handle -> m a -> m a Source #
Utility function since we're not using the new IO library yet.
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.
hMaybeReadNewline :: Handle -> IO () Source #
returnOnEOF :: MonadMask m => a -> m a -> m a Source #
hGetLocaleLine :: Handle -> MaybeT IO ByteString Source #
Utility function to correctly get a line of input as an undecoded ByteString.
Constructors
| KeyChar Char | |
| FunKey Int | |
| LeftKey | |
| RightKey | |
| DownKey | |
| UpKey | |
| KillLine | |
| Home | |
| End | |
| PageDown | |
| PageUp | |
| Backspace | |
| Delete | |
| SearchReverse | |
| SearchForward |
simpleChar :: Char -> Key Source #
setControlBits :: Char -> Char Source #
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 | |
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 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 | |
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.
stringToGraphemes :: String -> [Grapheme] Source #
Converts a string into a sequence of graphemes.
NOTE: Drops any initial, unattached combining characters.
graphemesToString :: [Grapheme] -> String Source #
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.
lineChars :: LineState s => Prefix -> s -> LineChars Source #
Accessor function for the various backends.
lengthToEnd :: LineChars -> Int Source #
Compute the number of characters under and to the right of the cursor.
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 | |
listRestore :: Save s => [Grapheme] -> s Source #
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 # | |
data InsertMode Source #
The standard line state representation; considers the cursor to be located between two characters. The first list is reversed.
Instances
| Show InsertMode Source # | |
Defined in System.Console.Haskeline.LineState Methods showsPrec :: Int -> InsertMode -> ShowS # show :: InsertMode -> String # showList :: [InsertMode] -> ShowS # | |
| Eq InsertMode Source # | |
Defined in System.Console.Haskeline.LineState | |
| 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 | |
emptyIM :: InsertMode Source #
insertChar :: Char -> InsertMode -> InsertMode Source #
Insert one character, which may be combining, to the left of the cursor.
insertString :: String -> InsertMode -> InsertMode Source #
Insert a sequence of characters to the left of the cursor.
replaceCharIM :: Char -> InsertMode -> InsertMode Source #
insertGraphemes :: [Grapheme] -> InsertMode -> InsertMode Source #
deleteNext :: InsertMode -> InsertMode Source #
deletePrev :: InsertMode -> InsertMode Source #
skipLeft :: (Char -> Bool) -> InsertMode -> InsertMode Source #
skipRight :: (Char -> Bool) -> InsertMode -> InsertMode Source #
goRightUntil :: (InsertMode -> Bool) -> InsertMode -> InsertMode Source #
goLeftUntil :: (InsertMode -> Bool) -> InsertMode -> InsertMode Source #
beforeChar :: (Char -> Bool) -> InsertMode -> Bool Source #
deleteChar :: CommandMode -> CommandMode Source #
replaceChar :: Char -> CommandMode -> CommandMode Source #
pasteGraphemesBefore :: [Grapheme] -> CommandMode -> CommandMode Source #
pasteGraphemesAfter :: [Grapheme] -> CommandMode -> CommandMode Source #
withCommandMode :: (InsertMode -> InsertMode) -> CommandMode -> CommandMode Source #
Used for commands which take an integer argument.
applyCmdArg :: (InsertMode -> InsertMode) -> ArgMode CommandMode -> CommandMode Source #
Constructors
| Message | |
Fields | |
Constructors
| Password | |
Fields
| |
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