Safe Haskell | None |
---|---|
Language | Haskell2010 |
The MonadFSM
class is the indexed monad for finite-state
machines.
Documentation
class IxMonad m => MonadFSM (m :: Row * -> Row * -> * -> *) where Source #
An indexed monad for finite-state machines, managing the state of named resources.
new :: Name n -> a -> m r (Extend n a r) () Source #
Creates a new resource by name.
get :: HasType n a r => Name n -> m r r a Source #
Returns an existing resource.
delete :: Name n -> m r (r .- n) () Source #
Deletes an existing resource named by its Name
.
enter :: r' ~ ((n .== b) .// r) => Name n -> b -> m r r' () Source #
Replaces the state of an existing resource named by its Name
.
update :: (HasType n a r, Modify n a r ~ r) => Name n -> (a -> a) -> m r r () Source #
Updates the state, using a pure function, of an existing
resource named by its Name
.
call :: m Empty Empty a -> m r r a Source #
Embed another MonadFSM
computation, with empty resource rows,
in this computation.
Instances
Monad m => MonadFSM (FSM m) Source # | |
Defined in Motor.FSM new :: Name n -> a -> FSM m r (Extend n a r) () Source # get :: HasType n a r => Name n -> FSM m r r a Source # delete :: Name n -> FSM m r (r .- n) () Source # enter :: r' ~ ((n .== b) .// r) => Name n -> b -> FSM m r r' () Source # update :: (HasType n a r, Modify n a r ~ r) => Name n -> (a -> a) -> FSM m r r () Source # |