| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Rasa.Internal.Action
- 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:
Constructors
| Action | |
Fields
| |
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
Constructors
| ActionState | |
asyncs :: Lens' ActionState [AsyncAction] Source #
class HasActionState a where Source #
Allows polymorphic lenses which need to access something in ActionState
Minimal complete definition
Methods
actionState :: Lens' a ActionState Source #
Instances
data BufActionState Source #
Contains all data about the editor; as well as a buffer which is in focus.
We keep the full ActionState here too so that Actions may be lifted inside a BufAction
Constructors
| BufActionState | |
Fields
| |
This is a monad-transformer stack for performing actions on a specific buffer.
You run BufActions by embedding them in a Action via bufferDo or buffersDo
Within a BufAction you can:
- Use
liftActionto run anAction; It is your responsibility to ensure that any nestedActions don't edit the Buffer which the currentBufActionis 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
BufActions from other extensions
Constructors
| BufAction | |
Fields
| |