Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Hook = Hook HookId (a -> Action ())
- data HookId = HookId Int TypeRep
- type Hooks = Map TypeRep [Hook]
- newtype Action a = Action {
- runAct :: StateT ActionState IO a
- execAction :: ActionState -> Action () -> IO ActionState
- evalAction :: ActionState -> Action a -> IO a
- type AsyncAction = Async (Action ())
- data ActionState = ActionState {}
- nextHook :: Lens' ActionState Int
- hooks :: Lens' ActionState Hooks
- ed :: Lens' ActionState Editor
- asyncs :: Lens' ActionState [AsyncAction]
- class HasActionState a where
- data BufActionState = BufActionState {
- _actState :: ActionState
- _buf :: Buffer
- buf :: Lens' BufActionState Buffer
- actState :: Lens' BufActionState ActionState
- newtype BufAction a = BufAction {
- runBufAct :: StateT BufActionState IO a
- liftBuf :: BufAction a -> BufRef -> Action (Maybe a)
- liftAction :: Action a -> BufAction a
Documentation
A wrapper around event listeners so they can be stored in Hooks
.
This is a monad-transformer stack for performing actions against the editor.
You register Actions to be run in response to events using onEveryTrigger
Within an Action you can:
Action | |
|
execAction :: ActionState -> Action () -> IO ActionState Source #
Execute an Action (returning the editor state)
evalAction :: ActionState -> Action a -> IO a Source #
Evaluate an Action (returning the value)
type AsyncAction = Async (Action ()) Source #
data ActionState Source #
This contains all data representing the editor's state. It acts as the state object for an 'Action
asyncs :: Lens' ActionState [AsyncAction] Source #
class HasActionState a where Source #
Allows polymorphic lenses which need to access something in ActionState
actionState :: Lens' a ActionState Source #
data BufActionState Source #
This is a monad-transformer stack for performing actions on a specific buffer.
You run BufAction
s by embedding them in a Action
via bufferDo
or buffersDo
Within a BufAction you can:
- Use
liftAction
to run anAction
; It is your responsibility to ensure that any nestedAction
s don't edit the Buffer which the currentBufAction
is editing; behaviour is undefined if this occurs. - Use liftIO for IO
- Access/Edit the buffer's
text
- Access/edit buffer extensions; see
bufExt
- Embed and sequence
BufAction
s from other extensions