eve-0.1.2: An extensible event framework

Safe HaskellNone
LanguageHaskell2010

Eve.Internal.States

Synopsis

Documentation

type States = Map TypeRep StateWrapper Source #

A map of state types to their current value.

class HasStates s where Source #

Represents a state which can itself store more states. states is a lens which points to a given state's States map.

Minimal complete definition

states

Methods

states :: Lens' s States Source #

class (Typeable s, HasStates 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.

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

A polymorphic lens which accesses stored states. It returns the default value (def) if a state has not yet been set.