0
我正在學習Haskell。無法匹配預期類型
下面的代碼不編譯
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.
任何幫助,將不勝感激。
現在編譯OK。謝謝你的幫助。 – user6340505
非常感謝 – user6340505