I can write the following:
{-
{-
{-
{-
f :: Integral a => (forall b. Num b => b) -> a
f = id
And everything's good. Presumably, GHC can get Integral
out Num
, so all is well.
I can get a little confused, but still good:
class Integral x => MyIntegral x
instance Integral x => MyIntegral x
class Num x => MyNum x
instance Num x => MyNum x
f' :: MyIntegral a => (forall b. MyNum b => b) -> a
f' = id
So, let's say I want to summarize it like this:
g :: c2 a => (forall b. c1 b => b) -> a
g = id
Now it’s obvious that this will affect the dummy because the GHC cannot get c2
out c1
, because it is c2
not limited.
What needs to be added to the type signature g
to say that "you can get c2
from c1
"?
source
share