Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Defines a parser for PGN; https://www.chessclub.com/help/pgn-spec.
Synopsis
- type Tag = String
- type IsStrictlySequential = Bool
- data PGN
- quoteDelimiter :: Char
- unknownTagValue :: Char
- dateTag :: Tag
- showsDate :: Day -> ShowS
- showsMoveText :: Game -> ShowS
- showsGame :: Game -> IO ShowS
- moveTextParser :: IsStrictlySequential -> ValidateMoves -> TextParser Game
- parser :: IsStrictlySequential -> ValidateMoves -> [Tag] -> TextParser PGN
- mkPGN :: Maybe Value -> Maybe Value -> Day -> Maybe Value -> Maybe Value -> Maybe Value -> [TagPair] -> Game -> PGN
- mkPGN' :: [Tag] -> [TagPair] -> Game -> PGN
Types
Type-synonyms
type IsStrictlySequential = Bool Source #
Whether moves with an unexpected move-number should be considered to be an error.
Data-types
- The data defined by PGN.
- The first six fields are mandatory according to the PGN-specification, though none are used by this application.
The seventh mandatory field Result can be derived from
getGame
.
Constants
quoteDelimiter :: Char Source #
Constant delimiter for a tag-value.
unknownTagValue :: Char Source #
Constant used to represent an unknown value for a mandatory tag.
Functions
showsMoveText :: Game -> ShowS Source #
- Represents the specified game in Portable Game Notation; https://www.chessclub.com/help/pgn-spec.
- This function is only responsible for the line defining the numbered sequence of moves represented in SAN.
showsGame :: Game -> IO ShowS Source #
Shows PGN for the specified game, with defaults for other fields.
moveTextParser :: IsStrictlySequential -> ValidateMoves -> TextParser Game Source #
Parses a game from PGN move-text.
:: IsStrictlySequential | |
-> ValidateMoves | |
-> [Tag] | Identify fields used to form a unique composite game-identifier. |
-> TextParser PGN |
- Parses PGN.
- CAVEAT: this function doesn't produce when using either Parsec or Poly.Plain, since it returns
Either
the appropriate constructor for which may be unknown until the last character is parsed. Equally for these parsers, all data must be strictly evaluated before any data can retrieved.