{-# LANGUAGE DerivingVia #-} module M where import Data.Proxy class Refine' a p where validate' :: Proxy p -> a -> () data T1 data T2 instance Refine' a T1 where validate' _ _ = () -- this gives a coerce error :( deriving via T1 instance Refine' a T2