How can I get GHC to generate instances of Data.Typeable for GADTs with Typeable in the context?
问题 Suppose I have the following code: {-# LANGUAGE GADTs, DeriveDataTypeable, StandaloneDeriving #-} import Data.Typeable class Eq t => OnlyEq t class (Eq t, Typeable t) => BothEqAndTypeable t data Wrapper a where Wrap :: BothEqAndTypeable a => a -> Wrapper a deriving instance Eq (Wrapper a) deriving instance Typeable1 Wrapper Then, the following instance declaration works, without a constraint on t : instance OnlyEq (Wrapper t) and does what I expect it to do. But the following instance