import Unsafe.Coerce (unsafeCoerce) import GHC.Exts class Foo a where v :: a -- the goal is to make it work without any method f :: Foo a => a f = v g :: forall a. a -> a g a = withDict @(Foo a) a f main = print $ g "abb"