
I am trying to understand the Typeclassopedia article by Brent Yorgey in Monad.Reader. I am simultaneously working my way through Real World Haskell, so I may be doing things a bit out of order. Here is my question (which may itself be unclear, as I am a true *noob* at this): Why are there two different kinds of "constraints" in a signature, viz. those that specify types and those that specify typeclasses? For instance, we could write this: f :: (Num d) => d -> String -> Int In my example above there are two kinds of things that constrain f: (a) d must be an instance of Num; and (b) the second argument to f must be of type String, and f must return an Int. I (more or less) understand that types and typeclasses are not the same. But it seems to me that they do conflate in a way, if we think of types as defined by functions on them. So why should we not be able to write: f :: Num d -> String -> Int TIA. Best, - Phil -