rasa-0.1.9: A modular text editor

Safe HaskellNone
LanguageHaskell2010

Rasa.Internal.BufAction

Synopsis

Documentation

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:

Constructors

BufAction 

Fields

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 #

getText :: BufAction YiString Source #

Returns the text of the current buffer

setText :: YiString -> BufAction () Source #

Sets the text of the current buffer

getRange :: CrdRange -> BufAction YiString Source #

Gets the range of text from the buffer

setRange :: CrdRange -> YiString -> BufAction () Source #

Sets the range of text from the buffer

liftState :: (BufActionState -> (a, BufActionState)) -> BufAction a Source #

Allows running state actions over BufActionState; used to lift mtl state functions

liftAction :: Action r -> BufAction r Source #

This lifts up an Action to be run inside a BufAction

runBufAction :: BufAction a -> BufRef -> Action (Maybe a) Source #

This lifts up a bufAction into an Action which performs the BufAction over the referenced buffer and returns the result (if the buffer existed)