bishbosh-0.0.0.5: Plays chess.

Safe HaskellNone
LanguageHaskell2010

BishBosh.ContextualNotation.PGN

Contents

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
Defines a parser for PGN; https://www.chessclub.com/user/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 number should be considered to be an error.

Data-types

data PGN x y Source #

  • 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 from getGame.
Instances
(Enum x, Enum y, Ord x, Ord y) => Eq (PGN x y) Source # 
Instance details

Defined in BishBosh.ContextualNotation.PGN

Methods

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

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

(Enum x, Enum y, Ord x, Ord y, Show x, Show y) => Show (PGN x y) Source # 
Instance details

Defined in BishBosh.ContextualNotation.PGN

Methods

showsPrec :: Int -> PGN x y -> ShowS #

show :: PGN x y -> String #

showList :: [PGN x y] -> ShowS #

(NFData x, NFData y) => NFData (PGN x y) Source # 
Instance details

Defined in BishBosh.ContextualNotation.PGN

Methods

rnf :: PGN x y -> () #

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 :: (Enum x, Enum y, Ord x, Ord y, Show x, Show y) => Game x y -> ShowS Source #

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.

parser Source #

Arguments

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

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 x y 
-> PGN x y 

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 x y 
-> PGN x y 

Smart-constructor.

Mutators

setGame :: Game x y -> PGN x y -> PGN x y Source #

Mutator.