eve-0.1.0: An extensible event framework
Eve.Internal.Extensions
Synopsis
type Exts = Map TypeRep Ext Source #
A map of extension types to their current value.
class HasExts s where Source #
Represents a state which can be extended. exts is a Lens' which points to the state's Exts
exts
Lens'
Exts
Minimal complete definition
Methods
exts :: Lens' s Exts Source #
Instances
exts :: Lens' AppState Exts Source #
class (Typeable s, HasExts s) => HasEvents s Source #
A typeclass to ensure people don't dispatch events to states which shouldn't accept them.
To allow dispatching events in an action over your state simply define the empty instance:
instance HasEvents MyState where
ext :: forall a e. (Show a, Typeable a, Default a, HasExts e) => Lens' e a Source #
A polymorphic lens which accesses extensions in the extension state. It returns the default value (def) if a state has not yet been set.
def