Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Defines a parser for PGN; https://www.chessclub.com/user/help/pgn-spec.
- 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 number should be considered to be an error.
Data-types
- The data defined by PGN.
- The first six fields are mandatory part according to the PGN-specification, though none are used by this application.
The seventh mandatory field
Result
can be derived fromgetGame
.
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/user/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 process is inherently strict when using either Parsec or Poly.Plain, since on failure they returns
Left
, which can't be determined until parsing has finished.
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.