Module

Game

Package
purescript-game
Repository
artemisSystem/purescript-game

#GameUpdate Source

newtype GameUpdate (extra :: Row Type) (req :: Row Type) (execOut :: Row Type) a

Constructors

#runUpdate Source

runUpdate :: forall a execOut req extra. Reducer extra req -> GameUpdate extra req execOut a -> Run execOut a

#Reducer Source

data Reducer (extra :: Row Type) (req :: Row Type)

#mkReducer Source

mkReducer :: forall extra_req req extra. Union extra req extra_req => ((Run (Anything + extra_req)) ~> (Run (Anything + req))) -> Reducer extra req

Create a Reducer. Note: doing mkReducer $ f will raise an EscapedSkolem error. Use parentheses or do instead of $.

#runReducer Source

runReducer :: forall a req_execIn req extra nubExecIn execIn update. Union execIn extra update => Union req execIn req_execIn => Nub execIn nubExecIn => Nub req_execIn nubExecIn => Reducer extra req -> (Run update a -> Run execIn a)

Turn a Reducer into a function that acts on a specific effect row

#composeReducer Source

composeReducer :: forall extra3r extra2r req extra3 extra2 extra1. Union extra1 extra2 extra3 => Union extra2 req extra2r => Union extra3 req extra3r => Union extra2r extra1 extra3r => Reducer extra1 req -> Reducer extra2 req -> Reducer extra3 req

Compose two Reducers left to right

#(>->) Source

Operator alias for Game.composeReducer (left-associative / precedence 5)

#identityReducer Source

identityReducer :: forall req. Reducer () req

The identity Reducer. runReducer identityReducer is the same as identity.

#Game Source

type Game (extra :: Row Type) (req :: Row Type) (execOut :: Row Type) a = Array (GameUpdate extra req execOut a)

#mkRunGame Source

mkRunGame :: forall b a interpreted execOut req extra. (Run execOut a -> Run interpreted b) -> (Array (Run interpreted b) -> Run interpreted b) -> (Reducer extra req -> Game extra req execOut a -> Run interpreted b)

Make a function that can run a Game in Run