This module defines the PieceType type and related functions. A
PieceType value is basically an uncolored chess piece.
Value representing a pawn.
Value representing a knight.
Value representing a bishop.
Value representing a rook.
Value representing a queen.
Value representing a king.
List of all piece types.
all =
[ pawn, knight, bishop, rook, queen, king ]List of all piece types to which a pawn can promote.
promotionPieces =
[ queen, rook, bishop, knight ]Tries to convert a character to a PieceType. Accepts both uppercase
and lowercase letters; returns Nothing if the character is not one of the
piece letters used in English algebraic notation.
fromChar 'P' == Just pawn
fromChar 'r' == Just rook
fromChar 'x' == NothingTries to convert a string to a PieceType, based on the first character
in the string. Accepts both uppercase and lowercase letters; returns
Nothing if the character is not one of the piece letters used in English
algebraic notation.
fromString "k" == Just king
fromString "Qa4+" == Just queen
fromString "x" == NothingConverts a PieceType to the corresponding character used in English
algebraic notation.
toChar pawn == 'P'
toChar knight == 'N'
toChar bishop == 'B'
toChar rook == 'R'
toChar queen == 'Q'
toChar king == 'K'Converts a PieceType to the a single-character string containing the
corresponding piece letter used in English algebraic notation.
toString pawn == "P"
toString knight == "N"
toString bishop == "B"
toString rook == "R"
toString queen == "Q"
toString king == "K"
A type representing the type of a chess piece, i.e. pawn, knight, bishop, etc. It's essentially a chess piece without information about its color.