module M where import Data.Coerce import Data.Functor.Identity class Foo where foo :: Int instance Foo where foo = 42 class Bar where bar :: Int instance Bar where bar = 42 data Dict c where Dict :: c => Dict c weird :: Dict Foo -> Dict Bar weird = coerce