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 x y
- quoteDelimiter :: Char
- unknownTagValue :: Char
- dateTag :: Tag
- showsDate :: Day -> ShowS
- showsMoveText :: (Enum x, Enum y, Ord x, Ord y, Show x, Show y) => Game x y -> ShowS
- showsGame :: (Enum x, Enum y, Ord x, Ord y, Show x, Show y) => Game x y -> IO ShowS
- moveTextParser :: (Enum x, Enum y, Ord x, Ord y, Show x, Show y) => IsStrictlySequential -> ValidateMoves -> TextParser (Game x y)
- parser :: (Enum x, Enum y, Ord x, Ord y, Show x, Show y) => IsStrictlySequential -> ValidateMoves -> [Tag] -> TextParser (PGN x y)
- mkPGN :: Maybe Value -> Maybe Value -> Day -> Maybe Value -> Maybe Value -> Maybe Value -> [TagPair] -> Game x y -> PGN x y
- mkPGN' :: [Tag] -> [TagPair] -> Game x y -> PGN x y
- setGame :: Game x y -> PGN x y -> PGN x y
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 :: (Enum x, Enum y, Ord x, Ord y, Show x, Show y) => Game x y -> 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 :: (Enum x, Enum y, Ord x, Ord y, Show x, Show y) => Game x y -> IO ShowS Source #
Shows PGN for the specified game, with defaults for other fields.
moveTextParser :: (Enum x, Enum y, Ord x, Ord y, Show x, Show y) => IsStrictlySequential -> ValidateMoves -> TextParser (Game x y) Source #
Parses a game from PGN move-text.
:: (Enum x, Enum y, Ord x, Ord y, Show x, Show y) | |
=> IsStrictlySequential | |
-> ValidateMoves | |
-> [Tag] | Identify fields used to form a unique composite game-identifier. |
-> TextParser (PGN x y) |
- 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.
Constructors
:: Maybe Value | Event-name. |
-> Maybe Value | Site-name. |
-> Day | |
-> Maybe Value | Round. |
-> Maybe Value | Name of White player. |
-> Maybe Value | Name of Black player. |
-> [TagPair] | Arbitrary tag-pairs. |
-> Game x y | |
-> PGN x y |
Smart constructor.
:: [Tag] | Identify fields used to form a unique composite game-identifier. |
-> [TagPair] | The data from which to extract the required values. |
-> Game x y | |
-> PGN x y |
Smart-constructor.