journeyman-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Tourney.Common

Description

Common types and functions

Synopsis

Types

Type-safe wrappers around numeric types

This prevents mixing up two different ideas, namely Slot and Player, due to their representations being the same.

newtype Player Source #

The basic type for a player is an Int denoting the "nth" best player in the tournament at the outset of it. A Player is the data that gets sorted by the sorting networks constructed by tournaments.

Constructors

Player Int 

Instances

Instances details
Bits Player Source # 
Instance details

Defined in Tourney.Common

Bounded Player Source # 
Instance details

Defined in Tourney.Common

Enum Player Source # 
Instance details

Defined in Tourney.Common

Ix Player Source # 
Instance details

Defined in Tourney.Common

Num Player Source # 
Instance details

Defined in Tourney.Common

Integral Player Source # 
Instance details

Defined in Tourney.Common

Real Player Source # 
Instance details

Defined in Tourney.Common

Show Player Source # 
Instance details

Defined in Tourney.Common

Eq Player Source # 
Instance details

Defined in Tourney.Common

Ord Player Source # 
Instance details

Defined in Tourney.Common

Unbox Player Source # 
Instance details

Defined in Tourney.Common

Vector Vector Player Source # 
Instance details

Defined in Tourney.Common

MVector MVector Player Source # 
Instance details

Defined in Tourney.Common

newtype Vector Player Source # 
Instance details

Defined in Tourney.Common

newtype MVector s Player Source # 
Instance details

Defined in Tourney.Common

newtype Slot Source #

A slot denotes an index into a round of a tournament, which a Player occupies.

Constructors

Slot Int 

Instances

Instances details
Bits Slot Source # 
Instance details

Defined in Tourney.Common

Bounded Slot Source # 
Instance details

Defined in Tourney.Common

Enum Slot Source # 
Instance details

Defined in Tourney.Common

Ix Slot Source # 
Instance details

Defined in Tourney.Common

Num Slot Source # 
Instance details

Defined in Tourney.Common

Integral Slot Source # 
Instance details

Defined in Tourney.Common

Real Slot Source # 
Instance details

Defined in Tourney.Common

Show Slot Source # 
Instance details

Defined in Tourney.Common

Eq Slot Source # 
Instance details

Defined in Tourney.Common

Methods

(==) :: Slot -> Slot -> Bool Source #

(/=) :: Slot -> Slot -> Bool Source #

Ord Slot Source # 
Instance details

Defined in Tourney.Common

Unbox Slot Source # 
Instance details

Defined in Tourney.Common

Vector Vector Slot Source # 
Instance details

Defined in Tourney.Common

MVector MVector Slot Source # 
Instance details

Defined in Tourney.Common

newtype Vector Slot Source # 
Instance details

Defined in Tourney.Common

newtype MVector s Slot Source # 
Instance details

Defined in Tourney.Common

newtype MVector s Slot = MUV_Slot (MVector s Int)

newtype RoundNo Source #

Round number

Constructors

RoundNo Int 

Instances

Instances details
Bits RoundNo Source # 
Instance details

Defined in Tourney.Common

Bounded RoundNo Source # 
Instance details

Defined in Tourney.Common

Enum RoundNo Source # 
Instance details

Defined in Tourney.Common

Ix RoundNo Source # 
Instance details

Defined in Tourney.Common

Num RoundNo Source # 
Instance details

Defined in Tourney.Common

Integral RoundNo Source # 
Instance details

Defined in Tourney.Common

Real RoundNo Source # 
Instance details

Defined in Tourney.Common

Show RoundNo Source # 
Instance details

Defined in Tourney.Common

Eq RoundNo Source # 
Instance details

Defined in Tourney.Common

Ord RoundNo Source # 
Instance details

Defined in Tourney.Common

Unbox RoundNo Source # 
Instance details

Defined in Tourney.Common

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

Vector Vector RoundNo Source # 
Instance details

Defined in Tourney.Common

MVector MVector RoundNo Source # 
Instance details

Defined in Tourney.Common

newtype Vector RoundNo Source # 
Instance details

Defined in Tourney.Common

newtype MVector s RoundNo Source # 
Instance details

Defined in Tourney.Common

Standings

data Standings Source #

A mapping from slots to players

Instances

Instances details
Show Standings Source # 
Instance details

Defined in Tourney.Common

Ixed Standings Source # 
Instance details

Defined in Tourney.Common

(AsRound a r, r ~ ()) => AsRound (Standings -> a) r Source # 
Instance details

Defined in Tourney.Algebra.Builder

Methods

toRound :: (Standings -> a) -> Round r () Source #

(AsSteps a r, r ~ ()) => AsSteps (Standings -> a) r Source # 
Instance details

Defined in Tourney.Algebra.Builder

Methods

steps :: (Standings -> a) -> Steps r () Source #

type Index Standings Source # 
Instance details

Defined in Tourney.Common

type IxValue Standings Source # 
Instance details

Defined in Tourney.Common

modifyStandings :: Standings -> (forall s. MVector s Player -> ST s ()) -> Standings Source #

Conversions

asInt :: Coercible a Int => a -> Int Source #

Ranges

(..<) :: (Enum a, Num a) => a -> a -> [a] infix 5 Source #

Create an increasing [closed, open) interval of slots

(..>) :: (Enum a, Num a) => a -> a -> [a] infix 5 Source #

Create a decreasing [closed, open) interval of slots

Sort methods

data SortMethod Source #

Constructors

WinnerTakesHigh 
PointsAward

Award points and use that to sort the results in the end

data Sorter Source #

Constructors

Sorter 

Instances

Instances details
Generic Sorter Source # 
Instance details

Defined in Tourney.Common

Associated Types

type Rep Sorter :: Type -> Type Source #

Show Sorter Source # 
Instance details

Defined in Tourney.Common

Eq Sorter Source # 
Instance details

Defined in Tourney.Common

type Rep Sorter Source # 
Instance details

Defined in Tourney.Common

type Rep Sorter = D1 ('MetaData "Sorter" "Tourney.Common" "journeyman-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Sorter" 'PrefixI 'True) (S1 ('MetaSel ('Just "sorterFocus") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Focus) :*: S1 ('MetaSel ('Just "sorterMethod") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SortMethod)))

Focus

data Focus Source #

The focus of a tournament over a sorting network. A good intuition is that a Focus is basically an array slice over a round.

Constructors

Focus 

Fields

Instances

Instances details
Generic Focus Source # 
Instance details

Defined in Tourney.Common

Associated Types

type Rep Focus :: Type -> Type Source #

Methods

from :: Focus -> Rep Focus x Source #

to :: Rep Focus x -> Focus Source #

Show Focus Source # 
Instance details

Defined in Tourney.Common

Eq Focus Source # 
Instance details

Defined in Tourney.Common

Methods

(==) :: Focus -> Focus -> Bool Source #

(/=) :: Focus -> Focus -> Bool Source #

Ord Focus Source # 
Instance details

Defined in Tourney.Common

type Rep Focus Source # 
Instance details

Defined in Tourney.Common

type Rep Focus = D1 ('MetaData "Focus" "Tourney.Common" "journeyman-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Focus" 'PrefixI 'True) (S1 ('MetaSel ('Just "focusStart") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Slot) :*: S1 ('MetaSel ('Just "focusLength") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)))

Arithmetic functions

Where appropriate these are overloaded to work with types that have the same representation as Int, such as Player, Slot, and RoundNo.

stride2 :: Int -> OrdPair Int Source #

Expand an index to 2 dimensions

nearestPow2Above :: Coercible Int a => a -> a Source #

Round to the nearest power of 2 above the input

bitLog2 :: Coercible Int a => a -> a Source #

Integer log2

isqrt :: Coercible Int a => a -> a Source #

Integer square root

triangular :: Coercible Int a => a -> a Source #

Generate the N-th triangular number