| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Tourney.Match
Synopsis
- data Match where
- createMatch :: Slot -> Slot -> Match
- createCheckedMatch :: Focus -> Slot -> Slot -> Maybe Match
- validateMatch :: Focus -> Match -> Bool
- likelyWinner :: Lens' Match Slot
- likelyLoser :: Lens' Match Slot
- matchIsWithin :: Match -> Focus -> Bool
- matchIsReversal :: MatchResult -> Bool
- data MatchResult = MatchResult {}
- newtype Points = Points (Vector Int)
- data Result = Result !Points !Points
- didSlot1Win :: MatchResult -> Maybe Bool
- didSlot2Win :: MatchResult -> Maybe Bool
- winner :: MatchResult -> Maybe (Slot, Points)
- loser :: MatchResult -> Maybe (Slot, Points)
Matches
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.
Instances
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
matchIsReversal :: MatchResult -> Bool Source #
Results
data MatchResult Source #
Constructors
| MatchResult | |
Instances
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
directly.Vector Int
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
Instances
| IsList Points Source # | |
| Num Points Source # | |
Defined in Tourney.Match | |
| Read Points Source # | |
| Show Points Source # | |
| Eq Points Source # | |
| Ord Points Source # | |
| type Item Points Source # | |
Defined in Tourney.Match | |
Instances
| Generic Result Source # | |
| Show Result Source # | |
| Eq Result Source # | |
| Ord Result Source # | |
| type Rep Result Source # | |
Defined in Tourney.Match type Rep Result = D1 ('MetaData "Result" "Tourney.Match" "journeyman-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Result" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Points) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Points))) | |
didSlot1Win :: MatchResult -> Maybe Bool Source #
didSlot2Win :: MatchResult -> Maybe Bool Source #