hfiar-0.1.2: Four in a Row in Haskell!!

HFiaR

Contents

Description

This module defines the HFiaR monad and all the actions you can perform in it

Synopsis

Monad controls

data HFiaRT m a Source

Generic HFiaRT type

Instances

play :: Monad m => HFiaRT m a -> m GameSource

eval :: Monad m => HFiaRT m a -> m aSource

Types

data Game Source

Game description

Instances

data Player Source

Posible players (each one with his tile colour)

Instances

data Tile Source

Posible tiles (just green or red ones)

Constructors

Red 
Green 

Instances

data HFiaRError Source

Posible errors in the HFiaR Monad

data HFiaRResult Source

Posible results for the game

Constructors

Tie 
WonBy Player 

Actions

dropInSource

Arguments

:: Monad m 
=> Int

Column number

-> HFiaRT m (Either HFiaRError ()) 

Drop a tile in a column

player :: Monad m => HFiaRT m (Either HFiaRError Player)Source

Player who's supposed to play the next tile

board :: Monad m => HFiaRT m [[Tile]]Source

Current board distribution

result :: Monad m => HFiaRT m (Either HFiaRError HFiaRResult)Source

If the game ended, returns the result of it