{-# OPTIONS -fglasgow-exts #-} class Foo a b where g :: a -> b type A = {- change the following -} Int type B = {- change the following -} Char instance Foo A B where g a = {- change the following -} ' ' type C = {- change the following -} Float type D = {- change the following -} String instance Foo C D where g c = {- change the following -} "" f :: (Foo a b, Foo c d) => a -> c -> (b, d) f x y = (g x, g y)