Safe HaskellSafe

Game.Monad

Synopsis

Documentation

newtype GameMonad a #

Monad to evaluate game a move in

Constructors

GameMonad 

Fields

Instances
Monad GameMonad # 
Instance details

Defined in Game.Monad

Methods

(>>=) :: GameMonad a -> (a -> GameMonad b) -> GameMonad b

(>>) :: GameMonad a -> GameMonad b -> GameMonad b

return :: a -> GameMonad a

fail :: String -> GameMonad a

Functor GameMonad # 
Instance details

Defined in Game.Monad

Methods

fmap :: (a -> b) -> GameMonad a -> GameMonad b

(<$) :: a -> GameMonad b -> GameMonad a

Applicative GameMonad # 
Instance details

Defined in Game.Monad

Methods

pure :: a -> GameMonad a

(<*>) :: GameMonad (a -> b) -> GameMonad a -> GameMonad b

liftA2 :: (a -> b -> c) -> GameMonad a -> GameMonad b -> GameMonad c

(*>) :: GameMonad a -> GameMonad b -> GameMonad b

(<*) :: GameMonad a -> GameMonad b -> GameMonad a

execState #

Arguments

:: GameMonad a

action to be executed

-> GameState

current state of the game

-> GameState

game state after the action

evaluate an action on a GameState and return new state

execStateWithUndo :: GameMonad a -> GameState -> GameState #

same as execState but save previous state for undo operations

get' :: GameMonad GameState #

get current GameState

for internal use only

getConfig :: GameMonad GameConfig #

get the GameConfig of the current state

getCells :: GameMonad CellStates #

get the CellStates of the current state

getCell :: BoardCoordinate -> GameMonad CellState #

get the CellState of the cell at given coordinate

setCell :: BoardCoordinate -> CellState -> GameMonad () #

update the CellState at the given coordinate

this will also automatically update the GlobalGameState