You could also use functional dependencies here:

{-# LANGUAGE FunctionalDependencies #-}

class Foo a b | a -> b where
bar :: a -> Int
foobar :: a -> b -> Int
foobar avalue bvalue = bar avalue

instance Foo Int Int where
bar i = 5

main = print $ bar (4::Int)

Here you are saying that the type parameter b is determined by the
parameter a, so GHC knows that the instance Foo Int Int is the only
instance of Foo with a = Int, thus removing the ambiguity.

--
Erlend Hamberg
ehamberg@gmail.com