-----------------------------------------------------------------------------
-- |
-- Module      : Chess.Player
-- Copyright   : (c) Michael Szvetits, 2023
-- License     : BSD-3-Clause (see the file LICENSE)
-- Maintainer  : typedbyte@qualified.name
-- Stability   : stable
-- Portability : portable
--
-- Types and functions to handle chess players.
-----------------------------------------------------------------------------
module Chess.Player where

import Chess.Color (Color)

-- | Represents a player who participates in a chess game.
--
-- Currently, a player is only identified by the color of the controlled chess pieces.
-- In the future, a player could have more attributes, like name, ELO rating, etc.
newtype Player = Player { Player -> Color
color :: Color }
  deriving (Player -> Player -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Player -> Player -> Bool
$c/= :: Player -> Player -> Bool
== :: Player -> Player -> Bool
$c== :: Player -> Player -> Bool
Eq, Eq Player
Player -> Player -> Bool
Player -> Player -> Ordering
Player -> Player -> Player
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Player -> Player -> Player
$cmin :: Player -> Player -> Player
max :: Player -> Player -> Player
$cmax :: Player -> Player -> Player
>= :: Player -> Player -> Bool
$c>= :: Player -> Player -> Bool
> :: Player -> Player -> Bool
$c> :: Player -> Player -> Bool
<= :: Player -> Player -> Bool
$c<= :: Player -> Player -> Bool
< :: Player -> Player -> Bool
$c< :: Player -> Player -> Bool
compare :: Player -> Player -> Ordering
$ccompare :: Player -> Player -> Ordering
Ord, ReadPrec [Player]
ReadPrec Player
Int -> ReadS Player
ReadS [Player]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Player]
$creadListPrec :: ReadPrec [Player]
readPrec :: ReadPrec Player
$creadPrec :: ReadPrec Player
readList :: ReadS [Player]
$creadList :: ReadS [Player]
readsPrec :: Int -> ReadS Player
$creadsPrec :: Int -> ReadS Player
Read, Int -> Player -> ShowS
[Player] -> ShowS
Player -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Player] -> ShowS
$cshowList :: [Player] -> ShowS
show :: Player -> String
$cshow :: Player -> String
showsPrec :: Int -> Player -> ShowS
$cshowsPrec :: Int -> Player -> ShowS
Show)