I'm using the -XExistentialQuantification
GHC extension to create a heterogeneous container for values of a specific type class (Shape
):
-- Container type
data Object = forall a. Shape a => Object a
-- 'Shape' class. Methods not important
class Eq s => Shape s where
doStuff :: s -> s
Given that all instances of Shape
are also instances of Eq
, is there a way to make Object
an instance of Eq
as well?