Quantified constraint blocks functional dependency
Consider
{-# LANGUAGE FunctionalDependencies, QuantifiedConstraints, AllowAmbiguousTypes #-}
module Bug2 where
class C a b | a -> b where
method :: a -> b -> ()
class Truth
instance Truth
f :: (C a b) => a -> ()
f x = method x undefined
g :: (Truth => C a b) => a -> ()
g x = method x undefined
f is accepted, while g is not (in every version of GHC I tested, including HEAD), due to ambiguity of b in the call to method. But, really, this should be accepted, because the premise of the quantified constraint in the type of g is satisfied. The functional dependency should thus choose the type of undefined to be b.