This module provides the most flexible way to handle state control via a MarionetteT monad transformer.

#Control Source

type Control :: Type -> Type -> (Type -> Type) -> Typetype Control msg sta m = msg -> MarionetteT msg sta m Unit

The high level control function. Takes a msg and returns a computation inside the MarionetteT monad transformer.

#MarionetteT Source

newtype MarionetteT :: Type -> Type -> (Type -> Type) -> Type -> Typenewtype MarionetteT msg sta (m :: Type -> Type) a

A monad transformer that adds the following features to the base monad m

  • read/write access to the program's state (sta) via a StateMonad instance
  • the ability to use sendMsg to raise messages (values of type msg) from within a control handler


#mkController Source

mkController :: forall msg sta. Control msg sta Aff -> Controller msg sta

Creates a low level controller when given a high level control function

#sendMsg Source

sendMsg :: forall msg sta m. Monad m => msg -> MarionetteT msg sta m Unit

Triggers a new message from within a control handler