bishbosh-0.1.4.0: Plays chess.
Safe HaskellNone
LanguageHaskell2010

BishBosh.ContextualNotation.PGN

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
Defines a parser for PGN; https://www.chessclub.com/help/pgn-spec.
Synopsis

Types

Type-synonyms

type Tag = String Source #

The type of the name of field in a PGN-specification.

type IsStrictlySequential = Bool Source #

Whether moves with an unexpected move-number should be considered to be an error.

Data-types

data PGN Source #

  • 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.

Instances

Instances details
Eq PGN Source # 
Instance details

Defined in BishBosh.ContextualNotation.PGN

Methods

(==) :: PGN -> PGN -> Bool #

(/=) :: PGN -> PGN -> Bool #

Show PGN Source # 
Instance details

Defined in BishBosh.ContextualNotation.PGN

Methods

showsPrec :: Int -> PGN -> ShowS #

show :: PGN -> String #

showList :: [PGN] -> ShowS #

NFData PGN Source # 
Instance details

Defined in BishBosh.ContextualNotation.PGN

Methods

rnf :: PGN -> () #

Constants

quoteDelimiter :: Char Source #

Constant delimiter for a tag-value.

unknownTagValue :: Char Source #

Constant used to represent an unknown value for a mandatory tag.

dateTag :: Tag Source #

Qualifies a mandatory tag-value.

Functions

showsDate :: Day -> ShowS Source #

Shows the specified date in double quotes.

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.

parser Source #

Arguments

:: 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.

Constructors

mkPGN Source #

Arguments

:: 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 
-> PGN 

Smart constructor.

mkPGN' Source #

Arguments

:: [Tag]

Identify fields used to form a unique composite game-identifier.

-> [TagPair]

The data from which to extract the required values.

-> Game 
-> PGN 

Smart constructor.