swapped class arguments with functional dependencies

The compiler gives an error message for the following code, as it derives f :: T -> () | C T Int. The instance provided is C Int T however.

class C a ~b :: a -> b

instance C Int T where
    C _ = undef

:: T = T

f :: a -> () | C a Int
f a = g 4 a

g :: a b -> () | C a b
g _ _ = undef