Given the following code:
class C a where
foo :: a -> a
f :: (C a) => a -> a
f = id
p :: (C a) => (a -> a) -> a -> a
p g = foo . g
Now, if I try to call pf, the GHC complains:
> p f
No instance for (C a0) arising from a use of `p'
In the expression: p f
In an equation for `it': it = p f
I find this somewhat unexpected, since f accepts only "a", which should be an instance of the type class C. What is the reason?
Edit: I know that I did not define any instance for C, but should not answer “correct”:
p f :: (C a) => a -> a
source
share