I got a data type "Cake"
*data Cake = EmptyBox | Food { name :: String
, flavors :: [Cake]} deriving( Read, Eq)*
instance Show Cake where
show cake = prints cake where
prints (Food name []) = name ++ "
"
I want to print cakes like this (each cake got different flavors)
Cake1
Chocolate
Nutella
Strawberry
Cake2
Chocolate
Vanilla
Cake3
But I got error, doesn't works! How can I do it?
See Question&Answers more detail:os