HFiaR
Description
This module defines the HFiaR monad and all the actions you can perform in it
- data HFiaRT m a
- play :: Monad m => HFiaRT m a -> m Game
- eval :: Monad m => HFiaRT m a -> m a
- type HFiaR = HFiaRT Maybe
- justPlay :: HFiaR a -> Game
- justEval :: HFiaR a -> a
- data Game
- data Player
- data Tile
- data HFiaRError
- = GameEnded
- | GameNotEnded
- | InvalidColumn
- | FullColumn
- data HFiaRResult
- dropIn :: Monad m => Int -> HFiaRT m (Either HFiaRError ())
- player :: Monad m => HFiaRT m (Either HFiaRError Player)
- board :: Monad m => HFiaRT m [[Tile]]
- result :: Monad m => HFiaRT m (Either HFiaRError HFiaRResult)
MonadTrans controls
Generic HFiaRT type
play :: Monad m => HFiaRT m a -> m GameSource
Starts a game, run the HFiaRT actions and returns the game wrapped up in the m monad
eval :: Monad m => HFiaRT m a -> m aSource
Starts a game, run the HFiaRT actions and returns the result of the last one wrapped up in the m monad
Monad controls
justEval :: HFiaR a -> aSource
Starts a game, run the HFiaRT actions and returns the result of the last one
Types
Posible tiles (just green or red ones)
data HFiaRError Source
Posible errors in the HFiaR Monad
Constructors
| GameEnded | |
| GameNotEnded | |
| InvalidColumn | |
| FullColumn |
Instances
Actions
Drop a tile in a column
player :: Monad m => HFiaRT m (Either HFiaRError Player)Source
Player who's supposed to play the next tile
result :: Monad m => HFiaRT m (Either HFiaRError HFiaRResult)Source
If the game ended, returns the result of it