oalg-base-1.1.4.0: Algebraic structures on oriented entities and limits as a tool kit to solve algebraic problems.
Copyright(c) Erich Gut
LicenseBSD3
Maintainerzerich.gut@gmail.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

OAlg.Control.Action

Description

Actions over a state type, i.e. statefull evaluation.

Synopsis

Documentation

newtype Action s x Source #

action over a state s.

Constructors

Action (s -> (x, s)) 

Instances

Instances details
Applicative (Action s) Source # 
Instance details

Defined in OAlg.Control.Action

Methods

pure :: a -> Action s a #

(<*>) :: Action s (a -> b) -> Action s a -> Action s b #

liftA2 :: (a -> b -> c) -> Action s a -> Action s b -> Action s c #

(*>) :: Action s a -> Action s b -> Action s b #

(<*) :: Action s a -> Action s b -> Action s a #

Functor (Action s) Source # 
Instance details

Defined in OAlg.Control.Action

Methods

fmap :: (a -> b) -> Action s a -> Action s b #

(<$) :: a -> Action s b -> Action s a #

Monad (Action s) Source # 
Instance details

Defined in OAlg.Control.Action

Methods

(>>=) :: Action s a -> (a -> Action s b) -> Action s b #

(>>) :: Action s a -> Action s b -> Action s b #

return :: a -> Action s a #

run :: Action s x -> s -> (x, s) Source #

running an action on the gicen state.

getState :: Action s s Source #

gets the state.

setState :: s -> Action s s Source #

sets the state.