wrote the code below and am getting some issues with it :
The error I am getting is : Data constructor not in scope: Int :: Int
If I eradicate the Numeric Int element from my array the code works perfectly fine, however Numeric Int is a constructor of the type Rank so it should also be included but I am unsure of how to include it without this error being produced.
Below is the code and apologises if this question is long-winded or silly, this is my first post on StackOverflow so any feedback on how this q was asked would also be greatly appreciated.
Any help would be immensely appreciated
import Test.QuickCheck
import Data.Data
import Data.Typeable
data Suit = Spades | Hearts | Clubs | Diamonds
deriving Show
data Colour = Black | Red
deriving Show
colour :: Suit -> Colour
colour Spades = Black
colour Hearts = Red
colour Diamonds = Red
colour Clubs = Black
data Rank = Numeric Int | Jack | Queen | King | Ace
deriving Show
rankBeats :: Rank -> Rank -> Bool
rankBeats _ Ace = False
rankBeats Ace _ = True
rankBeats _ King = False
rankBeats King _ = True
rankBeats _ Queen = False
rankBeats Queen _ = True
rankBeats _ Jack = False
rankBeats Jack _ = True
rankBeats (Numeric m) (Numeric n) = m > n
prop_rankBeats :: Rank -> Rank -> Bool
prop_rankBeats a b = rankBeats a b || rankBeats b a
instance Arbitrary Rank where
arbitrary = elements [Numeric Int,Jack, Queen, King, Ace]