Haskell type signature with multiple type somethings (predicates?, for example Eq a =>)
- by Andrew
I'm not sure if type predicates is the right term, in fact I've never learned the word for this, so an edit to correct would be helpful - I'm referring to when you give the tipe of function f :: a -> b and you want to say a is a Eq and you say f :: Eq a => a -> b, the name for Eq a => - this is the thing i called a type predicate.
My question, though, is how to have multiple of these, so if A is an Eq and B is a Num, I could say either f :: Eq a => a -> b or f :: Num b => a -> b.
So, how can I have Eq a => and Num b => at the same time?
f :: Eq a => Num b => a -> b,
f :: Eq a -> Num b => a -> b, and
f :: Eq a, Num b => a -> b
all didn't do what I wanted.