Why this code doesn't work?
class Foo a where foo :: Proxy a -> Int bar :: Foo a => a -> Int bar _ = foo (Proxy :: Proxy a)
It fails to compile with the message:
Could not deduce (Foo a0) arising from a use of `foo' from the context (Foo a) bound by the type signature for bar :: Foo a => a -> Int The type variable `a0' is ambiguous In the expression: foo (Proxy :: Proxy a) In an equation for `bar': bar _ = foo (Proxy :: Proxy a)
I tried it with and without ScopedTypeVariables extension