我有3 data
的定义:
data ActionCard = ActionCard {
actionCardCost :: Int,
plusActions :: Int,
plusBuys :: Int,
plusCards :: Int,
plusCoins :: Int
} deriving (Show)
data TreasureCard = TreasureCard {
treasureCardCost :: Int,
treasureCardValue :: Int
} deriving (Show)
data VictoryCard = VictoryCard {
victoryCardCost :: Int,
victoryCardValue :: Int
} deriving (Show)
我想定义Card
,使得任何位置Card
类型被使用,这意味着值是的ActionCard
,TreasureCard
,或{{1的实例}}。
基本上我希望VictoryCard
是这三个人都从OOP借用的接口。
我希望能够写
Card