-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Simple library for validating chess moves and parsing PGN files
--
-- With this library you can load chess boards from FEN and PGN notation
-- and apply moves to the boards. Moves will only be allowed if they are
-- valid under the normal chess rules.
@package chesshs
@version 0.1
-- | The main move validation module. FEN parsing code is in Chess.FEN and
-- PGN parsing is in Chess.PGN
module Chess
data MoveError
-- | It's not your turn
WrongTurn :: MoveError
-- | There is no piece at the from position
NoPiece :: MoveError
-- | Your king is checked and this move doesn't solve that
IsCheck :: MoveError
-- | After this move your king would be checked
CausesCheck :: MoveError
-- | This is not how that piece works
InvalidMove :: MoveError
-- | You cannot move over other pieces
OverPiece :: MoveError
-- | This move captures one of your own pieces
CapturesOwn :: MoveError
-- | I don't understand what you mean
NoParse :: MoveError
data Color
Black :: Color
White :: Color
data PieceType
Rook :: PieceType
Knight :: PieceType
Bishop :: PieceType
Queen :: PieceType
King :: PieceType
Pawn :: PieceType
data Piece
Piece :: Color -> PieceType -> Piece
clr :: Piece -> Color
piece :: Piece -> PieceType
data Board
Board :: Color -> String -> Maybe (Int, Int) -> Array (Int, Int) (Maybe Piece) -> Board
turn :: Board -> Color
castlingAvail :: Board -> String
enpassant :: Board -> Maybe (Int, Int)
board :: Board -> Array (Int, Int) (Maybe Piece)
-- | Takes a position like a5 and returns the coordinates (0,4)
strToPos :: String -> (Int, Int)
-- | Like pieceAtStr, but with coordinates instead of a string
pieceAt :: Int -> Int -> Board -> Maybe Piece
-- | What piece is currently at this position on the board?
pieceAtStr :: String -> Board -> Maybe Piece
-- | Perform a move on the board in coordinate notation like e2e4,
-- returning either the new board or an error
move :: [Char] -> Board -> Either MoveError Board
-- | Perform a move in SAN notation on the board and return either the new
-- board or an error
moveSAN :: [Char] -> Board -> Either MoveError Board
-- | Is the player of the given colour check?
check :: Color -> Board -> Bool
-- | Is the player with the given colour checkmate
mate :: Color -> Board -> Bool
-- | Can the player of the given colour make any move?
stalemate :: Color -> Board -> Bool
instance Eq MoveError
instance Show MoveError
instance Eq MoveType
instance Show MoveType
instance Eq Color
instance Show Color
instance Eq PieceType
instance Show PieceType
instance Eq Piece
instance Eq Board
instance Show Board
instance Show Piece
instance Read Piece