journeyman-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Tourney.Match.Matrix

Description

Sparse matrices for holding matches

Synopsis

Documentation

data MatchMatrix Source #

An abstraction around a mutable store of rounds of matches and their results. Conceptually it stores a matrix of matches by (round, player1, player2), and a variable for the current round.

Instances

Instances details
Generic MatchMatrix Source # 
Instance details

Defined in Tourney.Match.Matrix

Associated Types

type Rep MatchMatrix :: Type -> Type Source #

type Rep MatchMatrix Source # 
Instance details

Defined in Tourney.Match.Matrix

newtype MapByRound a Source #

Constructors

ByRound (IntMap a) 

Instances

Instances details
Foldable MapByRound Source # 
Instance details

Defined in Tourney.Match.Matrix

Methods

fold :: Monoid m => MapByRound m -> m Source #

foldMap :: Monoid m => (a -> m) -> MapByRound a -> m Source #

foldMap' :: Monoid m => (a -> m) -> MapByRound a -> m Source #

foldr :: (a -> b -> b) -> b -> MapByRound a -> b Source #

foldr' :: (a -> b -> b) -> b -> MapByRound a -> b Source #

foldl :: (b -> a -> b) -> b -> MapByRound a -> b Source #

foldl' :: (b -> a -> b) -> b -> MapByRound a -> b Source #

foldr1 :: (a -> a -> a) -> MapByRound a -> a Source #

foldl1 :: (a -> a -> a) -> MapByRound a -> a Source #

toList :: MapByRound a -> [a] Source #

null :: MapByRound a -> Bool Source #

length :: MapByRound a -> Int Source #

elem :: Eq a => a -> MapByRound a -> Bool Source #

maximum :: Ord a => MapByRound a -> a Source #

minimum :: Ord a => MapByRound a -> a Source #

sum :: Num a => MapByRound a -> a Source #

product :: Num a => MapByRound a -> a Source #

Traversable MapByRound Source # 
Instance details

Defined in Tourney.Match.Matrix

Methods

traverse :: Applicative f => (a -> f b) -> MapByRound a -> f (MapByRound b) Source #

sequenceA :: Applicative f => MapByRound (f a) -> f (MapByRound a) Source #

mapM :: Monad m => (a -> m b) -> MapByRound a -> m (MapByRound b) Source #

sequence :: Monad m => MapByRound (m a) -> m (MapByRound a) Source #

Functor MapByRound Source # 
Instance details

Defined in Tourney.Match.Matrix

Methods

fmap :: (a -> b) -> MapByRound a -> MapByRound b Source #

(<$) :: a -> MapByRound b -> MapByRound a Source #

FoldableWithIndex RoundNo MapByRound Source # 
Instance details

Defined in Tourney.Match.Matrix

Methods

ifoldMap :: Monoid m => (RoundNo -> a -> m) -> MapByRound a -> m Source #

ifoldMap' :: Monoid m => (RoundNo -> a -> m) -> MapByRound a -> m Source #

ifoldr :: (RoundNo -> a -> b -> b) -> b -> MapByRound a -> b Source #

ifoldl :: (RoundNo -> b -> a -> b) -> b -> MapByRound a -> b Source #

ifoldr' :: (RoundNo -> a -> b -> b) -> b -> MapByRound a -> b Source #

ifoldl' :: (RoundNo -> b -> a -> b) -> b -> MapByRound a -> b Source #

FunctorWithIndex RoundNo MapByRound Source # 
Instance details

Defined in Tourney.Match.Matrix

Methods

imap :: (RoundNo -> a -> b) -> MapByRound a -> MapByRound b Source #

TraversableWithIndex RoundNo MapByRound Source # 
Instance details

Defined in Tourney.Match.Matrix

Methods

itraverse :: Applicative f => (RoundNo -> a -> f b) -> MapByRound a -> f (MapByRound b) Source #

TraverseMax RoundNo MapByRound Source # 
Instance details

Defined in Tourney.Match.Matrix

TraverseMin RoundNo MapByRound Source # 
Instance details

Defined in Tourney.Match.Matrix

Semigroup a => Monoid (MapByRound a) Source # 
Instance details

Defined in Tourney.Match.Matrix

Semigroup a => Semigroup (MapByRound a) Source # 
Instance details

Defined in Tourney.Match.Matrix

Show a => Show (MapByRound a) Source # 
Instance details

Defined in Tourney.Match.Matrix

Eq a => Eq (MapByRound a) Source # 
Instance details

Defined in Tourney.Match.Matrix

At (MapByRound a) Source # 
Instance details

Defined in Tourney.Match.Matrix

Ixed (MapByRound a) Source # 
Instance details

Defined in Tourney.Match.Matrix

AsEmpty (MapByRound a) Source # 
Instance details

Defined in Tourney.Match.Matrix

Methods

_Empty :: Prism' (MapByRound a) () Source #

type Index (MapByRound a) Source # 
Instance details

Defined in Tourney.Match.Matrix

type IxValue (MapByRound a) Source # 
Instance details

Defined in Tourney.Match.Matrix

type IxValue (MapByRound a) = a

newtype MapByMatches a Source #

A sparse matrix for storing a map between matches and a value.

Since the two players in Match are guaranteed to be ordered (low, high) we only need to ever check the low->high->match path in the nested intmaps.

Constructors

ByMatches (IntMap (IntMap a)) 

Instances

Instances details
Foldable MapByMatches Source # 
Instance details

Defined in Tourney.Match.Matrix

Methods

fold :: Monoid m => MapByMatches m -> m Source #

foldMap :: Monoid m => (a -> m) -> MapByMatches a -> m Source #

foldMap' :: Monoid m => (a -> m) -> MapByMatches a -> m Source #

foldr :: (a -> b -> b) -> b -> MapByMatches a -> b Source #

foldr' :: (a -> b -> b) -> b -> MapByMatches a -> b Source #

foldl :: (b -> a -> b) -> b -> MapByMatches a -> b Source #

foldl' :: (b -> a -> b) -> b -> MapByMatches a -> b Source #

foldr1 :: (a -> a -> a) -> MapByMatches a -> a Source #

foldl1 :: (a -> a -> a) -> MapByMatches a -> a Source #

toList :: MapByMatches a -> [a] Source #

null :: MapByMatches a -> Bool Source #

length :: MapByMatches a -> Int Source #

elem :: Eq a => a -> MapByMatches a -> Bool Source #

maximum :: Ord a => MapByMatches a -> a Source #

minimum :: Ord a => MapByMatches a -> a Source #

sum :: Num a => MapByMatches a -> a Source #

product :: Num a => MapByMatches a -> a Source #

Traversable MapByMatches Source # 
Instance details

Defined in Tourney.Match.Matrix

Methods

traverse :: Applicative f => (a -> f b) -> MapByMatches a -> f (MapByMatches b) Source #

sequenceA :: Applicative f => MapByMatches (f a) -> f (MapByMatches a) Source #

mapM :: Monad m => (a -> m b) -> MapByMatches a -> m (MapByMatches b) Source #

sequence :: Monad m => MapByMatches (m a) -> m (MapByMatches a) Source #

Functor MapByMatches Source # 
Instance details

Defined in Tourney.Match.Matrix

Methods

fmap :: (a -> b) -> MapByMatches a -> MapByMatches b Source #

(<$) :: a -> MapByMatches b -> MapByMatches a Source #

FoldableWithIndex Match MapByMatches Source # 
Instance details

Defined in Tourney.Match.Matrix

Methods

ifoldMap :: Monoid m => (Match -> a -> m) -> MapByMatches a -> m Source #

ifoldMap' :: Monoid m => (Match -> a -> m) -> MapByMatches a -> m Source #

ifoldr :: (Match -> a -> b -> b) -> b -> MapByMatches a -> b Source #

ifoldl :: (Match -> b -> a -> b) -> b -> MapByMatches a -> b Source #

ifoldr' :: (Match -> a -> b -> b) -> b -> MapByMatches a -> b Source #

ifoldl' :: (Match -> b -> a -> b) -> b -> MapByMatches a -> b Source #

FunctorWithIndex Match MapByMatches Source # 
Instance details

Defined in Tourney.Match.Matrix

Methods

imap :: (Match -> a -> b) -> MapByMatches a -> MapByMatches b Source #

TraversableWithIndex Match MapByMatches Source # 
Instance details

Defined in Tourney.Match.Matrix

Methods

itraverse :: Applicative f => (Match -> a -> f b) -> MapByMatches a -> f (MapByMatches b) Source #

Monoid (MapByMatches a) Source # 
Instance details

Defined in Tourney.Match.Matrix

Semigroup (MapByMatches a) Source # 
Instance details

Defined in Tourney.Match.Matrix

Show a => Show (MapByMatches a) Source # 
Instance details

Defined in Tourney.Match.Matrix

Eq a => Eq (MapByMatches a) Source # 
Instance details

Defined in Tourney.Match.Matrix

At (MapByMatches a) Source # 
Instance details

Defined in Tourney.Match.Matrix

Ixed (MapByMatches a) Source # 
Instance details

Defined in Tourney.Match.Matrix

AsEmpty (MapByMatches a) Source # 
Instance details

Defined in Tourney.Match.Matrix

Methods

_Empty :: Prism' (MapByMatches a) () Source #

type Index (MapByMatches a) Source # 
Instance details

Defined in Tourney.Match.Matrix

type IxValue (MapByMatches a) Source # 
Instance details

Defined in Tourney.Match.Matrix

type IxValue (MapByMatches a) = a

addMatch :: MatchMatrix -> RoundNo -> Match -> STM () Source #

Add a match. It must not exist already in the current round

setMatchResult :: MatchMatrix -> RoundNo -> Match -> Result -> STM () Source #

Set a match result. It must already exist in the current round, by addMatch