License | GPL-2 |
---|---|
Maintainer | yi-devel@googlegroups.com |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Extensions |
|
Combinators for building keymaps.
Synopsis
- data Event = Event Key [Modifier]
- data Key
- data Modifier
- prettyEvent :: Event -> String
- eventToChar :: Event -> Char
- data I ev w a
- data P event w
- data InteractState event w
- class (Eq w, Monad m, Alternative m, Applicative m, MonadPlus m) => MonadInteract m w e | m -> w e where
- eventBounds :: Ord e => Maybe e -> Maybe e -> m e
- adjustPriority :: Int -> m ()
- choice :: (MonadInteract m w e, MonadFail m) => [m a] -> m a
- option :: MonadInteract m w e => a -> m a -> m a
- oneOf :: (Ord event, MonadInteract m w event, MonadFail m) => [event] -> m event
- accepted :: Show ev => Int -> P ev w -> [[Text]]
- mkAutomaton :: Eq w => I ev w a -> P ev w
- event :: (Ord event, MonadInteract m w event) => event -> m event
- deprioritize :: MonadInteract f w e => f ()
- important :: MonadInteract f w e => f a -> f a -> f a
- (<||) :: MonadInteract f w e => f a -> f a -> f a
- (||>) :: MonadInteract f w e => f a -> f a -> f a
- processOneEvent :: Eq w => P event w -> event -> ([w], P event w)
- computeState :: Eq w => P event w -> InteractState event w
- events :: (Ord event, MonadInteract m w event) => [event] -> m [event]
- idAutomaton :: (Ord a, Eq a) => P a a
- runWrite :: Eq w => P event w -> [event] -> [w]
- anyEvent :: (Ord event, MonadInteract m w event) => m event
- eventBetween :: (Ord e, MonadInteract m w e) => e -> e -> m e
- printableChar :: (MonadFail m, MonadInteract m w Event) => m Char
- textChar :: KeymapM Char
- charOf :: (MonadFail m, MonadInteract m w Event) => (Event -> Event) -> Char -> Char -> m Char
- shift :: Event -> Event
- meta :: Event -> Event
- ctrl :: Event -> Event
- super :: Event -> Event
- hyper :: Event -> Event
- spec :: Key -> Event
- char :: Char -> Event
- (>>!) :: (MonadInteract m Action Event, YiAction a x, Show x) => m b -> a -> m ()
- (>>=!) :: (MonadInteract m Action Event, YiAction a x, Show x) => m b -> (b -> a) -> m ()
- (?>>) :: MonadInteract m action Event => Event -> m a -> m a
- (?>>!) :: (MonadInteract m Action Event, YiAction a x, Show x) => Event -> a -> m ()
- (?*>>) :: MonadInteract m action Event => [Event] -> m a -> m a
- (?*>>!) :: (MonadInteract m Action Event, YiAction a x, Show x) => [Event] -> a -> m ()
- ctrlCh :: Char -> Event
- metaCh :: Char -> Event
- hyperCh :: Char -> Event
- optMod :: (MonadFail m, MonadInteract m w Event) => (Event -> Event) -> Event -> m Event
- pString :: MonadInteract m w Event => String -> m [Event]
Documentation
KEsc | |
KFun Int | |
KPrtScr | |
KPause | |
KASCII Char | |
KBS | |
KIns | |
KHome | |
KPageUp | |
KDel | |
KEnd | |
KPageDown | |
KNP5 | |
KUp | |
KMenu | |
KLeft | |
KDown | |
KRight | |
KEnter | |
KTab |
prettyEvent :: Event -> String Source #
eventToChar :: Event -> Char Source #
Map an Event to a Char. This is used in the emacs keymap for Ctrl-Q and vim keymap insertSpecialChar
Interactive process description
Operational representation of a process
data InteractState event w Source #
Abstraction of the automaton state.
Instances
Monoid (InteractState event w) Source # | |
Defined in Yi.Interact mempty :: InteractState event w # mappend :: InteractState event w -> InteractState event w -> InteractState event w # mconcat :: [InteractState event w] -> InteractState event w # | |
Semigroup (InteractState event w) Source # | |
Defined in Yi.Interact (<>) :: InteractState event w -> InteractState event w -> InteractState event w # sconcat :: NonEmpty (InteractState event w) -> InteractState event w # stimes :: Integral b => b -> InteractState event w -> InteractState event w # |
class (Eq w, Monad m, Alternative m, Applicative m, MonadPlus m) => MonadInteract m w e | m -> w e where Source #
Abstraction of monadic interactive processes
eventBounds :: Ord e => Maybe e -> Maybe e -> m e Source #
Consumes and returns the next character. Fails if there is no input left, or outside the given bounds.
adjustPriority :: Int -> m () Source #
Instances
MonadInteract m w e => MonadInteract (StateT s m) w e Source # | |
Eq w => MonadInteract (I event w) w event Source # | |
choice :: (MonadInteract m w e, MonadFail m) => [m a] -> m a Source #
Combines all parsers in the specified list.
option :: MonadInteract m w e => a -> m a -> m a Source #
option x p
will either parse p
or return x
without consuming
any input.
event :: (Ord event, MonadInteract m w event) => event -> m event Source #
Parses and returns the specified character.
deprioritize :: MonadInteract f w e => f () Source #
important :: MonadInteract f w e => f a -> f a -> f a Source #
Just like (<||)
but in prefix form. It deprioritize
s the
second argument.
(<||) :: MonadInteract f w e => f a -> f a -> f a infixl 3 Source #
(||>) :: MonadInteract f w e => f a -> f a -> f a Source #
computeState :: Eq w => P event w -> InteractState event w Source #
events :: (Ord event, MonadInteract m w event) => [event] -> m [event] Source #
Parses and returns the specified list of events (lazily).
anyEvent :: (Ord event, MonadInteract m w event) => m event Source #
eventBetween :: (Ord e, MonadInteract m w e) => e -> e -> m e Source #
printableChar :: (MonadFail m, MonadInteract m w Event) => m Char Source #
charOf :: (MonadFail m, MonadInteract m w Event) => (Event -> Event) -> Char -> Char -> m Char Source #
(>>!) :: (MonadInteract m Action Event, YiAction a x, Show x) => m b -> a -> m () infixl 1 Source #
p >>! act = p >> 'write' act
(>>=!) :: (MonadInteract m Action Event, YiAction a x, Show x) => m b -> (b -> a) -> m () infixl 1 Source #
p >>=! act = p >>= 'write' . act
(?>>) :: MonadInteract m action Event => Event -> m a -> m a infixr 0 Source #
ev ?>> proc = event
ev >> proc
(?>>!) :: (MonadInteract m Action Event, YiAction a x, Show x) => Event -> a -> m () infixr 0 Source #
(?*>>) :: MonadInteract m action Event => [Event] -> m a -> m a infixr 0 Source #
ev ?*>> proc = events
ev >> proc
(?*>>!) :: (MonadInteract m Action Event, YiAction a x, Show x) => [Event] -> a -> m () infixr 0 Source #