|
|
scott wrote:
>> data Suit = Diamonds | Hearts | Clubs | Spades
>>
>> data Number =
>> Ace | Two | Three | Four | Five | Six | Seven | Eight | Nine | Ten |
>> Jack | Queen | King
>>
>> data Card = Card Suit Number
>
> I get "parse error on input 'data'" for all those.
>
> Guess I'm missing some #include or whatever it's called.
Which way are you trying to execute this?
If you're trying to enter them interactively, don't. It doesn't work. ;-)
The GHC interactive interpretter ("GHCi") allows you to define variables
and use them later, but doesn't allow any other kinds of definitions
interactively.
If you write this stuff in a file and save it as, say, "Cards.hs", you
should be able to double-click that file and have GHCi automatically
open up and load it. You can then write expressions involving these types.
(Probably the next problem you'll trip over is that the types aren't
printable...)
Post a reply to this message
|
|