Infer type context in a type signature
If I have code such as
class Foo f where
foo :: a -> f a
data Bar f a = Foo f => Bar {bar :: f a}
instance Foo (Bar f) where
foo a = Bar (foo a)
GHC will demand Foo f =>
on the instance declaration, even though this can be inferred from the definition of Bar.
I understand why this is happening, but it should not be necessary to repeat information already given. Some code violates DRY dozens of times because of this limitation.