我有一个数据类型为 Card 的已安装模块。我将其设为 Show 类的实例,但 ghci 出现问题:
module Poker where
data Card = Card Int
...
instance Show Card where
show card = ...
...
我打开 ghci 并输入:
>:m + Poker
>Card 0
..
..
..
(Nothing) => I stop the execution
>Poker.show (Card 0)
> "Ace of Hearts"
看来我的数据类型不是Show类的实例,为什么?
谢谢大家!有用!:)