rasa-0.1.9: A modular text editor

Safe HaskellNone
LanguageHaskell2010

Rasa.Internal.Extensions

Synopsis

Documentation

data Ext Source #

A wrapper around an extension of any type so it can be stored in an ExtMap

Constructors

Show a => Ext a 

Instances

Show Ext Source # 

Methods

showsPrec :: Int -> Ext -> ShowS #

show :: Ext -> String #

showList :: [Ext] -> ShowS #

type ExtMap = Map TypeRep Ext Source #

A map of extension types to their current value.

class HasBufExts s where Source #

Members of this class have access to buffer extensions. (Each Buffer is a member of this class)

Minimal complete definition

bufExts

Methods

bufExts :: Lens' s (Map TypeRep Ext) Source #

This lens focuses the Extensions States map of the in-scope buffer.

class HasExts s where Source #

Members of this class have access to editor extensions.

Minimal complete definition

exts

Methods

exts :: Lens' s (Map TypeRep Ext) Source #

This lens focuses the Extensions States

bufExt :: forall a s. (Show a, Typeable a, Default a, HasBufExts 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.

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

This 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.