class X a b where { xfoo :: a -> b; } class X a b => C a b where { cfoo :: a -> b -> b; } class Y a where { yfoo :: a -> Int; } instance X a Int where { xfoo x = 42; } instance Y a => C a Int where { cfoo x y = yfoo x + xfoo x + y; } f x = cfoo x 42;