I have seen an example where you define the tuple type in this way:
countRepetitions :: (Integral a, Integral (a,a)) => [a] -> a -> (a,a)
But when I execute the code appears the message:
Non type-variable argument in the constraint: Integral (a, a)
How can I declare a tuple type?
You don't need to constraint with Integral (a, a)
. The constraint Integral a
forces all values for type a
to be Integral
. Try rewriting it like this:
countRepetitions :: Integral a => [a] -> a -> (a,a)