typed-fsm-0.3.0.1: A framework for strongly typed FSM
Safe HaskellNone
LanguageGHC2021

TypedFsm.Core

Synopsis

Documentation

class StateTransMsg ps Source #

The state-transition type class

Associated Types

data Msg ps (st :: ps) (st' :: ps) Source #

data Operate (a :: Type -> Type) (b :: ps -> Type) (c :: ps) where Source #

Core AST

Essentially all we do is build this AST and then interpret it.

`Operate m ia st` is an instance of IMonad, and it contains an m internally

Typed-fsm only contains two core functions: getInput, liftm. We use these two functions to build Operate.

The overall behavior is as follows: constantly reading messages from the outside and converting them into internal monads action.

Constructors

IReturn :: forall ps (b :: ps -> Type) (c :: ps) (a :: Type -> Type). b c -> Operate a b c 
LiftM :: forall {ps} (mode' :: ps) (a :: Type -> Type) (b :: ps -> Type) (c :: ps). Sing mode' -> a (Operate a b mode') -> Operate a b c 
In :: forall ps (a :: Type -> Type) (c :: ps) (b :: ps -> Type). (Msg ps c ~> Operate a b) -> Operate a b c 

Instances

Instances details
Functor m => IFunctor (Operate m :: (k1 -> Type) -> k1 -> Type) Source # 
Instance details

Defined in TypedFsm.Core

Methods

imap :: forall (a :: k1 -> Type) (b :: k1 -> Type). (a ~> b) -> Operate m a ~> Operate m b Source #

Functor m => IMonad (Operate m :: (k -> Type) -> k -> Type) Source # 
Instance details

Defined in TypedFsm.Core

Methods

ireturn :: forall (a :: k -> Type). a ~> Operate m a Source #

ibind :: forall (a :: k -> Type) (b :: k -> Type). (a ~> Operate m b) -> Operate m a ~> Operate m b Source #

getInput :: forall ps (m :: Type -> Type) (from :: ps). Functor m => Operate m (Msg ps from) from Source #

get messages from outside

liftm :: forall ps m (mode :: ps) a. (Functor m, SingI mode) => m a -> Operate m (At a mode) mode Source #

lifts the internal `m a` to `Operate m (At a i) i'