rasa-0.1.6: A modular text editor

Safe HaskellNone
LanguageHaskell2010

Rasa.Internal.Editor

Contents

Synopsis

Accessing/Storing state

data Editor Source #

This is the primary state of the editor.

class HasEditor a where Source #

This allows polymorphic lenses over anything that has access to an Editor context

Minimal complete definition

editor

Methods

editor :: Lens' a Editor Source #

buffers :: HasEditor e => Lens' e (IntMap Buffer) Source #

A lens over the map of available buffers

exiting :: HasEditor e => Lens' e Bool Source #

A lens over the exiting status of the editor

ext :: forall a e. (Show a, Typeable a, Default a, HasEditor e) => Lens' e a Source #

ext is a lens which will focus the extension state that matches the type inferred as the focal point. It's a little bit of magic, if you treat the focus as a member of your extension state it should just work out.

This lens falls back on the extension's Default instance (when getting) if nothing has yet been stored.

bufExt :: forall a s. (Show a, Typeable a, Default a, HasBuffer s) => Lens' s a Source #

bufExt is a lens which will focus a given extension's state within a buffer (within a BufAction). The lens will automagically focus the required extension by using type inference. It's a little bit of magic, if you treat the focus as a member of your extension state it should just work out.

This lens falls back on the extension's Default instance (when getting) if nothing has yet been stored.

nextBufId :: HasEditor e => Lens' e Int Source #

A lens over the next buffer id to be allocated

newtype BufRef Source #

An opaque reference to a buffer (The contained Int is not meant to be altered). It is possible for references to become stale if buffers are deleted. Operations over invalid BufRef's are simply ignored and return Nothing if a value was expected.

Constructors

BufRef Int