I'm very new to haskell, so sorry in advance.
I'm writing a program thats has a custom type "Rank". (The rank of a blackjack-card)
data Rank = Int | Jack | Queen | King | Ace
data Suit = Club | Diamond | Heart | Spade
data Card = Card Rank Suit
getCardValue :: Card -> Int
getCardValue (Card val _) = valueOfRank val
valueOfRank :: Rank -> Int
valueOfRank (Int i) = i --Doesnt work
valueOfRank Jack = 10
valueOfRank Queen = 10
valueOfRank King = 10
valueOfRank Ace = 11
Now I want to receive the respective value of a card with a function, my problem is, that I dont know how to typecheck if the value is of the type Int.