我試圖讓我的Cell
類型爲Show
typeclass的成員。 show a
線路有問題。如何確保a
在該展示櫃中是Char
?我希望這些陳述的順序只是讓它能夠處理它,但那並不是。Typeclass聲明類型不匹配
data Cell = Solid | Blank | Char
instance Show (Cell) where
show Solid = "X"
show Blank = "_";
show a = [a]
main = print $ show Solid