Actually it did resolve the ambiguity. The problem is that 4 :: Num a => a
so GHC can't decide that you want to use foo :: Int -> Int -> Int
. Now if instead you did
foo (4 :: Int) (4 :: Int)
> 8
Since now it is clear which instance we want to use. To make this clearer, suppose we had
class Foo a b c | a -> b, a -> c where
...
Now we could do
foo (4 :: Int) 4
> 8
since once GHC has filled in all the type variables not on the right side of an ->
, it can fill in the rest.