yi-core-0.19.4: Yi editor core library
LicenseGPL-2
Maintaineryi-devel@googlegroups.com
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010
Extensions
  • OverloadedStrings
  • FlexibleContexts

Yi.Keymap.Keys

Description

Combinators for building keymaps.

Synopsis

Documentation

data Event Source #

Constructors

Event Key [Modifier] 

Instances

Instances details
Show Event Source # 
Instance details

Defined in Yi.Event

Methods

showsPrec :: Int -> Event -> ShowS #

show :: Event -> String #

showList :: [Event] -> ShowS #

Eq Event Source # 
Instance details

Defined in Yi.Event

Methods

(==) :: Event -> Event -> Bool #

(/=) :: Event -> Event -> Bool #

Ord Event Source # 
Instance details

Defined in Yi.Event

Methods

compare :: Event -> Event -> Ordering #

(<) :: Event -> Event -> Bool #

(<=) :: Event -> Event -> Bool #

(>) :: Event -> Event -> Bool #

(>=) :: Event -> Event -> Bool #

max :: Event -> Event -> Event #

min :: Event -> Event -> Event #

data Key Source #

Instances

Instances details
Show Key Source # 
Instance details

Defined in Yi.Event

Methods

showsPrec :: Int -> Key -> ShowS #

show :: Key -> String #

showList :: [Key] -> ShowS #

Eq Key Source # 
Instance details

Defined in Yi.Event

Methods

(==) :: Key -> Key -> Bool #

(/=) :: Key -> Key -> Bool #

Ord Key Source # 
Instance details

Defined in Yi.Event

Methods

compare :: Key -> Key -> Ordering #

(<) :: Key -> Key -> Bool #

(<=) :: Key -> Key -> Bool #

(>) :: Key -> Key -> Bool #

(>=) :: Key -> Key -> Bool #

max :: Key -> Key -> Key #

min :: Key -> Key -> Key #

data Modifier Source #

Constructors

MShift 
MCtrl 
MMeta 
MSuper 
MHyper 

Instances

Instances details
Show Modifier Source # 
Instance details

Defined in Yi.Event

Eq Modifier Source # 
Instance details

Defined in Yi.Event

Ord Modifier Source # 
Instance details

Defined in Yi.Event

eventToChar :: Event -> Char Source #

Map an Event to a Char. This is used in the emacs keymap for Ctrl-Q and vim keymap insertSpecialChar

data I ev w a Source #

Interactive process description

Instances

Instances details
MonadFail (I event w) Source # 
Instance details

Defined in Yi.Interact

Methods

fail :: String -> I event w a #

Alternative (I ev w) Source # 
Instance details

Defined in Yi.Interact

Methods

empty :: I ev w a #

(<|>) :: I ev w a -> I ev w a -> I ev w a #

some :: I ev w a -> I ev w [a] #

many :: I ev w a -> I ev w [a] #

Applicative (I ev w) Source # 
Instance details

Defined in Yi.Interact

Methods

pure :: a -> I ev w a #

(<*>) :: I ev w (a -> b) -> I ev w a -> I ev w b #

liftA2 :: (a -> b -> c) -> I ev w a -> I ev w b -> I ev w c #

(*>) :: I ev w a -> I ev w b -> I ev w b #

(<*) :: I ev w a -> I ev w b -> I ev w a #

Functor (I event w) Source # 
Instance details

Defined in Yi.Interact

Methods

fmap :: (a -> b) -> I event w a -> I event w b #

(<$) :: a -> I event w b -> I event w a #

Monad (I event w) Source # 
Instance details

Defined in Yi.Interact

Methods

(>>=) :: I event w a -> (a -> I event w b) -> I event w b #

(>>) :: I event w a -> I event w b -> I event w b #

return :: a -> I event w a #

Eq w => MonadPlus (I event w) Source # 
Instance details

Defined in Yi.Interact

Methods

mzero :: I event w a #

mplus :: I event w a -> I event w a -> I event w a #

Eq w => MonadInteract (I event w) w event Source # 
Instance details

Defined in Yi.Interact

Methods

write :: w -> I event w () Source #

eventBounds :: Maybe event -> Maybe event -> I event w event Source #

adjustPriority :: Int -> I event w () Source #

data P event w Source #

Operational representation of a process

Constructors

End 
forall mid.(Show mid, Eq mid) => Chain (P event mid) (P mid w) 

Instances

Instances details
(Show w, Show ev) => Show (P ev w) Source # 
Instance details

Defined in Yi.Interact

Methods

showsPrec :: Int -> P ev w -> ShowS #

show :: P ev w -> String #

showList :: [P ev w] -> ShowS #

data InteractState event w Source #

Abstraction of the automaton state.

Constructors

Ambiguous [(Int, w, P event w)] 
Waiting 
Dead 
Running w (P event w) 

Instances

Instances details
Monoid (InteractState event w) Source # 
Instance details

Defined in Yi.Interact

Methods

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 # 
Instance details

Defined in Yi.Interact

Methods

(<>) :: 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

Minimal complete definition

write, eventBounds, adjustPriority

Methods

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

Instances details
MonadInteract m w e => MonadInteract (StateT s m) w e Source # 
Instance details

Defined in Yi.Interact

Methods

write :: w -> StateT s m () Source #

eventBounds :: Maybe e -> Maybe e -> StateT s m e Source #

adjustPriority :: Int -> StateT s m () Source #

Eq w => MonadInteract (I event w) w event Source # 
Instance details

Defined in Yi.Interact

Methods

write :: w -> I event w () Source #

eventBounds :: Maybe event -> Maybe event -> I event w event Source #

adjustPriority :: Int -> I event w () 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.

oneOf :: (Ord event, MonadInteract m w event, MonadFail m) => [event] -> m event Source #

accepted :: Show ev => Int -> P ev w -> [[Text]] Source #

mkAutomaton :: Eq w => I ev w a -> P ev w Source #

event :: (Ord event, MonadInteract m w event) => event -> m event Source #

Parses and returns the specified character.

important :: MonadInteract f w e => f a -> f a -> f a Source #

Just like (<||) but in prefix form. It deprioritizes 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 #

processOneEvent :: Eq w => P event w -> event -> ([w], P event w) 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).

idAutomaton :: (Ord a, Eq a) => P a a Source #

runWrite :: Eq w => P event w -> [event] -> [w] Source #

anyEvent :: (Ord event, MonadInteract m w event) => m event Source #

eventBetween :: (Ord e, MonadInteract m w e) => e -> e -> m e Source #

textChar :: KeymapM Char Source #

Parse any character that can be inserted in the text.

spec :: Key -> Event Source #

Convert a special key into an event

(>>!) :: (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 #

 ev ?>>! act = event ev >> write act

(?*>>) :: 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 #

 ev ?*>>! act = events ev >> write act

optMod :: (MonadFail m, MonadInteract m w Event) => (Event -> Event) -> Event -> m Event Source #

optMod f ev produces a MonadInteract that consumes ev or f ev