I have the code:
data Value = A|Two|Three...Ten|J|Q|K deriving (Eq, Ord, Enum)
instance Show Value where
show A = "A"
show Two = "2"
....
show K = "K"
And another data Suite
with a similar Show
instance for Hearts
, Spades
, Clubs
, and Diamonds
.
If I have
type Card = (Value, Suite)
Is it possible to create a show function that would transform (A, Spades)
into the string "AS"
?
(Value, Suite)
into a newtype and write an instance ofShow
for it. Or write a separate function, sayshowCard
for the tuple without wrapping.