I am learning Haskell.
the following code is not compiling
data Player = Max | Min
deriving (Show,Eq)
class Position a where
score :: a -> Int
player :: a -> Player
data Nim = Nim { turn :: Player, count :: Int}
instance Position Nim where
score a = count a
player a = turn a
error: Could not match expected type Nim with actual type 'a'. 'a' is a rigid type variable bound by the input signature for player :: a -> Player.
Any help would be appreciated.