Here is my code how can I say where n is int between 2..10
data Rank = Numeric Integer | Jack | Queen | King | Ace
deriving (Eq, Show)
valueRank :: Rank ->Integer
valueRank rank
|rank ==Jack = 10
|rank ==King = 10
|rank ==Queen = 10
|rank ==Ace = 10
|rank == Numeric n = n
where n =[x|x<-[2..10]]
[x | x <- [2..10]]
returns a list, so in that last linen
is of type[Integer]
. You can't really restrict the range ofn
on the type level. You'll probably just want to check it before it even gets added toNumeric
– Farley Knight