import Unsafe.Coerce (unsafeCoerce) class Foo r f :: (Eq a, Foo a) => a -> a f a = a g :: Eq a => a -> a g = unsafeCoerce f f2 :: (Eq a, Num a) => a -> a f2 a = a g2 :: Eq a => a -> a g2 = unsafeCoerce f2 main = print $ g "abb"