rasa-0.1.10: A modular text editor

Safe HaskellNone
LanguageHaskell2010

Rasa.Internal.ActionMonads

Synopsis

Documentation

newtype Action a Source #

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 Actions exported other extensions
  • Embed buffer actions using bufDo or buffersDo
  • Add/Edit/Focus buffers and a few other Editor-level things, see the Rasa.Internal.Actions module.

Constructors

Action 

Fields

Instances

Monad Action Source # 

Methods

(>>=) :: Action a -> (a -> Action b) -> Action b #

(>>) :: Action a -> Action b -> Action b #

return :: a -> Action a #

fail :: String -> Action a #

Functor Action Source # 

Methods

fmap :: (a -> b) -> Action a -> Action b #

(<$) :: a -> Action b -> Action a #

Applicative Action Source # 

Methods

pure :: a -> Action a #

(<*>) :: Action (a -> b) -> Action a -> Action b #

(*>) :: Action a -> Action b -> Action b #

(<*) :: Action a -> Action b -> Action a #

MonadIO Action Source # 

Methods

liftIO :: IO a -> Action a #

HasExtMonad Action Source # 

Methods

getExt :: (Typeable * ext, Show ext, Default ext) => Action ext Source #

setExt :: (Typeable * ext, Show ext, Default ext) => ext -> Action () Source #

overExt :: (Typeable * ext, Show ext, Default ext) => (ext -> ext) -> Action () Source #

newtype BufAction a Source #

This is a monad 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 liftAction to run an Action
  • Use liftIO for IO
  • Access/Edit the buffer's text; some commands are available in Rasa.Internal.Actions.
  • Access/edit buffer extensions; see bufExt
  • Embed and sequence BufActions from other extensions

Constructors

BufAction 

Instances

Monad BufAction Source # 

Methods

(>>=) :: BufAction a -> (a -> BufAction b) -> BufAction b #

(>>) :: BufAction a -> BufAction b -> BufAction b #

return :: a -> BufAction a #

fail :: String -> BufAction a #

Functor BufAction Source # 

Methods

fmap :: (a -> b) -> BufAction a -> BufAction b #

(<$) :: a -> BufAction b -> BufAction a #

Applicative BufAction Source # 

Methods

pure :: a -> BufAction a #

(<*>) :: BufAction (a -> b) -> BufAction a -> BufAction b #

(*>) :: BufAction a -> BufAction b -> BufAction b #

(<*) :: BufAction a -> BufAction b -> BufAction a #

MonadIO BufAction Source # 

Methods

liftIO :: IO a -> BufAction a #

HasExtMonad BufAction Source # 

Methods

getExt :: (Typeable * ext, Show ext, Default ext) => BufAction ext Source #

setExt :: (Typeable * ext, Show ext, Default ext) => ext -> BufAction () Source #

overExt :: (Typeable * ext, Show ext, Default ext) => (ext -> ext) -> BufAction () Source #

data ActionF next where Source #

Free Monad Actions for Action

Constructors

LiftIO :: IO next -> ActionF next 
BufferDo :: [BufRef] -> BufAction r -> ([r] -> next) -> ActionF next 
DispatchActionAsync :: IO (Action ()) -> next -> ActionF next 
AsyncActionProvider :: ((Action () -> IO ()) -> IO ()) -> next -> ActionF next 
AddBuffer :: YiString -> (BufRef -> next) -> ActionF next 
GetBufRefs :: ([BufRef] -> next) -> ActionF next 
GetExt :: (Typeable ext, Show ext, Default ext) => (ext -> next) -> ActionF next 
SetExt :: (Typeable ext, Show ext, Default ext) => ext -> next -> ActionF next 
GetEditor :: (Editor -> next) -> ActionF next 
GetBuffer :: BufRef -> (Maybe Buffer -> next) -> ActionF next 
Exit :: next -> ActionF next 
ShouldExit :: (Bool -> next) -> ActionF next 

Instances

Functor ActionF Source # 

Methods

fmap :: (a -> b) -> ActionF a -> ActionF b #

(<$) :: a -> ActionF b -> ActionF a #

data BufActionF next where Source #

Free Monad Actions for BufAction

Constructors

GetText :: (YiString -> next) -> BufActionF next 
SetText :: YiString -> next -> BufActionF next 
GetBufRef :: (BufRef -> next) -> BufActionF next 
GetBufExt :: (Typeable ext, Show ext, Default ext) => (ext -> next) -> BufActionF next 
SetBufExt :: (Typeable ext, Show ext, Default ext) => ext -> next -> BufActionF next 
SetRange :: CrdRange -> YiString -> next -> BufActionF next 
LiftAction :: Action r -> (r -> next) -> BufActionF next 
BufLiftIO :: IO next -> BufActionF next 

Instances

Functor BufActionF Source # 

Methods

fmap :: (a -> b) -> BufActionF a -> BufActionF b #

(<$) :: a -> BufActionF b -> BufActionF a #

liftActionF :: ActionF a -> Action a Source #

Embeds a ActionF type into the Action Monad

liftBufAction :: BufActionF a -> BufAction a Source #

Embeds a BufActionF type into the BufAction Monad