hfiar-0.1.0: Four in a Row in Haskell!!Source codeContentsIndex
HFiaR
Contents
Monad controls
Types
Actions
Description
This module defines the HFiaR monad and all the actions you can perform in it
Synopsis
data HFiaRT m a
type HFiaR = HFiaRT IO
play :: Monad m => HFiaRT m a -> m a
data Player
= Red
| Green
data HFiaRError
= GameEnded
| GameNotEnded
| InvalidColumn
| FullColumn
data HFiaRResult
= Tie
| WonBy Player
dropIn :: Int -> HFiaR (Either HFiaRError ())
currentPlayer :: HFiaR (Either HFiaRError Player)
board :: HFiaR [[Player]]
result :: HFiaR (Either HFiaRError HFiaRResult)
Monad controls
data HFiaRT m a Source
Generic HFiaRT type
show/hide Instances
type HFiaR = HFiaRT IOSource
Specialized HFiaR IO monadic type
play :: Monad m => HFiaRT m a -> m aSource
Run the monad actions and return the result of them
Types
data Player Source
Posible tile / player colours
Constructors
Red
Green
show/hide Instances
data HFiaRError Source
Posible errors in the HFiaR Monad
Constructors
GameEnded
GameNotEnded
InvalidColumn
FullColumn
show/hide Instances
data HFiaRResult Source
Posible results for the game
Constructors
Tie
WonBy Player
show/hide Instances
Actions
dropInSource
:: IntColumn number
-> HFiaR (Either HFiaRError ())
Drop a tile in a column
currentPlayer :: HFiaR (Either HFiaRError Player)Source
Player who's supposed to play the next tile
board :: HFiaR [[Player]]Source
Current board distribution
result :: HFiaR (Either HFiaRError HFiaRResult)Source
If the game ended, returns the result of it
Produced by Haddock version 2.7.2