Copyright | (c) Mario Lang 2021 |
---|---|
License | BSD3 |
Maintainer | mlang@blind.guru |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A PGN file consists of a list of games. Each game consists of a tag list, the outcome, and a forest of rosetrees.
Synopsis
- newtype PGN = PGN [Game]
- data Game = CG {}
- cgTags :: Lens' Game [(Text, Text)]
- cgOutcome :: Lens' Game Outcome
- cgForest :: Lens' Game [Tree (Annotated Ply)]
- data Outcome
- _Win :: Prism' Outcome Color
- _Draw :: Prism' Outcome ()
- _Undecided :: Prism' Outcome ()
- data Annotated a = Ann {
- _annPrefixNAG :: ![Int]
- _annPly :: !a
- _annSuffixNAG :: ![Int]
- annPrefixNAG :: forall a. Lens' (Annotated a) [Int]
- annPly :: forall a a. Lens (Annotated a) (Annotated a) a a
- annSuffixNAG :: forall a. Lens' (Annotated a) [Int]
- readPGNFile :: MonadIO m => FilePath -> m (Either String PGN)
- gameFromForest :: [(Text, Text)] -> [Tree Ply] -> Outcome -> Game
- pgnForest :: PGN -> [Tree Ply]
- pgn :: Parser PGN
- hPutPGN :: Handle -> RAVOrder (Doc ann) -> PGN -> IO ()
- pgnDoc :: RAVOrder (Doc ann) -> PGN -> Doc ann
- type RAVOrder a = ([Tree (Annotated Ply)] -> a) -> [Tree (Annotated Ply)] -> [a]
- breadthFirst :: RAVOrder a
- depthFirst :: RAVOrder a
- gameDoc :: RAVOrder (Doc ann) -> Game -> Doc ann
- weightedForest :: PGN -> [Tree (Rational, Ply)]
Documentation
Instances
Generic Game Source # | |
Show Game Source # | |
Eq Game Source # | |
Hashable Game Source # | |
Defined in Game.Chess.PGN | |
type Rep Game Source # | |
Defined in Game.Chess.PGN type Rep Game = D1 ('MetaData "Game" "Game.Chess.PGN" "chessIO-0.9.3.1-FhorHdlbYNXK07vrmB8ltu" 'False) (C1 ('MetaCons "CG" 'PrefixI 'True) (S1 ('MetaSel ('Just "_cgTags") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [(Text, Text)]) :*: (S1 ('MetaSel ('Just "_cgForest") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [Tree (Annotated Ply)]) :*: S1 ('MetaSel ('Just "_cgOutcome") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Outcome)))) |
Instances
Generic Outcome Source # | |
Show Outcome Source # | |
Eq Outcome Source # | |
Ord Outcome Source # | |
Hashable Outcome Source # | |
Defined in Game.Chess.PGN | |
Pretty Outcome Source # | |
Defined in Game.Chess.PGN | |
Lift Outcome Source # | |
type Rep Outcome Source # | |
Defined in Game.Chess.PGN type Rep Outcome = D1 ('MetaData "Outcome" "Game.Chess.PGN" "chessIO-0.9.3.1-FhorHdlbYNXK07vrmB8ltu" 'False) (C1 ('MetaCons "Win" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Color)) :+: (C1 ('MetaCons "Draw" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Undecided" 'PrefixI 'False) (U1 :: Type -> Type))) |
_Undecided :: Prism' Outcome () Source #
Ann | |
|
Instances
Applicative Annotated Source # | |
Functor Annotated Source # | |
Generic (Annotated a) Source # | |
Show a => Show (Annotated a) Source # | |
Eq a => Eq (Annotated a) Source # | |
Hashable a => Hashable (Annotated a) Source # | |
Defined in Game.Chess.PGN | |
Lift a => Lift (Annotated a :: Type) Source # | |
type Rep (Annotated a) Source # | |
Defined in Game.Chess.PGN type Rep (Annotated a) = D1 ('MetaData "Annotated" "Game.Chess.PGN" "chessIO-0.9.3.1-FhorHdlbYNXK07vrmB8ltu" 'False) (C1 ('MetaCons "Ann" 'PrefixI 'True) (S1 ('MetaSel ('Just "_annPrefixNAG") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [Int]) :*: (S1 ('MetaSel ('Just "_annPly") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "_annSuffixNAG") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [Int])))) |
A PGN parser
Prettyprinting
breadthFirst :: RAVOrder a Source #
depthFirst :: RAVOrder a Source #