Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype Action a = Action {
- getAction :: Free (ActionF ActionState) a
- runAction :: ActionState -> Action a -> IO (a, ActionState)
- evalAction :: ActionState -> Action a -> IO a
- execAction :: ActionState -> Action a -> IO ActionState
- data ActionState
- mkActionState :: Output (Action ()) -> ActionState
- data Listener = Listener ListenerId (a -> Action ())
- data ListenerId = ListenerId Int TypeRep
- type Listeners = Map TypeRep [Listener]
- listeners :: Lens' ActionState Listeners
- nextListenerId :: Lens' ActionState Int
- actionQueue :: Lens' ActionState (Output (Action ()))
Documentation
This is a monad for performing actions against the editor.
You can register Actions to be run in response to events using onEveryTrigger
Within an Action you can:
- Use liftIO for IO
- Access/edit extensions that are stored globally, see
ext
- Embed any
Action
s exported other extensions - Embed buffer actions using
bufDo
orbuffersDo
- Add/Edit/Focus buffers and a few other Editor-level things, see the Rasa.Internal.Actions module.
Action | |
|
runAction :: ActionState -> Action a -> IO (a, ActionState) Source #
Runs an Action into an IO
evalAction :: ActionState -> Action a -> IO a Source #
Evals an Action into an IO
execAction :: ActionState -> Action a -> IO ActionState Source #
Execs an Action into an IO
data ActionState Source #
This contains all data representing the editor's state. It acts as the state object for an 'Action
mkActionState :: Output (Action ()) -> ActionState Source #
A wrapper around event listeners so they can be stored in Listeners
.
Listener ListenerId (a -> Action ()) |
data ListenerId Source #
An opaque reverence to a specific registered event-listener.
A ListenerId is used only to remove listeners later with removeListener
.
type Listeners = Map TypeRep [Listener] Source #
A map of Event types to a list of listeners for that event
actionQueue :: Lens' ActionState (Output (Action ())) Source #