eve-0.1.0: An extensible event framework

Safe HaskellNone
LanguageHaskell2010

Eve.Internal.Extensions

Synopsis

Documentation

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

Minimal complete definition

exts

Methods

exts :: Lens' s 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
  • - Don't need anything here.

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.