module SquareDefs where

import Control.DeepSeq

data Square = Black | White Char

instance Show Square where
  show Black = "@"
  show (White c) = [c]

instance Eq Square where
  (==) Black Black = True
  (==) (White a) (White b) = (a == b)
  (==) _ _ = False

instance NFData Square where
  rnf s = s `seq` ()

instance Ord Square where 
  Black `compare` Black = EQ
  (White a) `compare` (White b) = (a `compare` b)
  Black `compare` _ = GT
  _ `compare` Black = LT

