journeyman-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Tourney.Match

Synopsis

Matches

data Match Source #

The basic type for a match is a pair of players. The Match type ensures by construction that the "lower" player always takes the first slot of the Match, and the higher the second. Many functions in this library are overloaded so that you can represent matches as ordinary Haskell tuples.

It is a runtime error to construct a match using the same player twice.

The first field of a Match is always the smaller value. Matches with one invalid Slot for any reason should be interpretted as a bye for the valid Slot in that match.

Constructors

Match_ !Slot !Slot 

Bundled Patterns

pattern Match :: Slot -> Slot -> Match 

Instances

Instances details
Generic Match Source # 
Instance details

Defined in Tourney.Match

Associated Types

type Rep Match :: Type -> Type Source #

Methods

from :: Match -> Rep Match x Source #

to :: Rep Match x -> Match Source #

Ix Match Source # 
Instance details

Defined in Tourney.Match

Show Match Source # 
Instance details

Defined in Tourney.Match

Eq Match Source # 
Instance details

Defined in Tourney.Match

Methods

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

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

Ord Match Source # 
Instance details

Defined in Tourney.Match

AsMatch Match Source # 
Instance details

Defined in Tourney.Algebra.Builder

Methods

toMatch :: Match -> Match 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 #

AsRound Match r Source # 
Instance details

Defined in Tourney.Algebra.Builder

Methods

toRound :: Match -> Round r () Source #

type Rep Match Source # 
Instance details

Defined in Tourney.Match

type Rep Match = D1 ('MetaData "Match" "Tourney.Match" "journeyman-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Match_" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Slot) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Slot)))

createMatch :: Slot -> Slot -> Match Source #

Create a match, throwing an error if it has negative or equal slots

createCheckedMatch :: Focus -> Slot -> Slot -> Maybe Match Source #

Create a match within the given focus, returning Nothing if it has negative or equal slots

Results

data MatchResult Source #

Constructors

MatchResult 

Fields

Instances

Instances details
Generic MatchResult Source # 
Instance details

Defined in Tourney.Match

Associated Types

type Rep MatchResult :: Type -> Type Source #

Show MatchResult Source # 
Instance details

Defined in Tourney.Match

Eq MatchResult Source # 
Instance details

Defined in Tourney.Match

Ord MatchResult Source # 
Instance details

Defined in Tourney.Match

type Rep MatchResult Source # 
Instance details

Defined in Tourney.Match

type Rep MatchResult = D1 ('MetaData "MatchResult" "Tourney.Match" "journeyman-0.1.0.0-inplace" 'False) (C1 ('MetaCons "MatchResult" 'PrefixI 'True) (S1 ('MetaSel ('Just "match") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Match) :*: S1 ('MetaSel ('Just "result") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Result)))

newtype Points Source #

A type for representing the score or points of a player.

The Eq, Ord, and Num instances of this type operate element-wise on the two inputs, treating values that are not present in one or the other, as zeros.

You may construct this by its Num instance which provides numeric literals for Points, or via its IsList instance, providing literal lists. Alternatively, the constructor is provided to pass in a Vector Int directly.

Points [0,0,0] == Points [] = True
Points [0,0,1] == Points [1] = True
Points [1,0,1] + Points [2,2] = Points [1,2,3]
Points [1,0,1] + Points [2,2,2] = Points [3,2,3]
1 == Points [1] = True -- fromInteger definition

Constructors

Points (Vector Int) 

Instances

Instances details
IsList Points Source # 
Instance details

Defined in Tourney.Match

Associated Types

type Item Points Source #

Num Points Source # 
Instance details

Defined in Tourney.Match

Read Points Source # 
Instance details

Defined in Tourney.Match

Show Points Source # 
Instance details

Defined in Tourney.Match

Eq Points Source # 
Instance details

Defined in Tourney.Match

Ord Points Source # 
Instance details

Defined in Tourney.Match

type Item Points Source # 
Instance details

Defined in Tourney.Match

type Item Points = Int

data Result Source #

Constructors

Result !Points !Points 

Instances

Instances details
Generic Result Source # 
Instance details

Defined in Tourney.Match

Associated Types

type Rep Result :: Type -> Type Source #

Show Result Source # 
Instance details

Defined in Tourney.Match

Eq Result Source # 
Instance details

Defined in Tourney.Match

Ord Result Source # 
Instance details

Defined in Tourney.Match

type Rep Result Source # 
Instance details

Defined in Tourney.Match