ghc-9.4.3: The GHC API
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.Tc.Deriv.Generics

Description

The deriving code for the Generic class

Synopsis

Documentation

data GenericKind Source #

Constructors

Gen0 
Gen1 

get_gen1_constrained_tys :: TyVar -> Type -> [Type] Source #

Called by inferConstraints; generates a list of types, each of which must be a Functor in order for the Generic1 instance to work. For instance, if we have:

data Foo a = MkFoo Int a (Maybe a) (Either Int (Maybe a))

Then get_gen1_constrained_tys a (f (g a)) would return [Either Int], as a derived Generic1 instance would need to call fmap at that type. Invoking get_gen1_constrained_tys a on any of the other fields would return [].

get_gen1_constrained_tys is very similar in spirit to deepSubtypesContaining in GHC.Tc.Deriv.Functor. Just like with deepSubtypesContaining, it is important that the TyVar argument come from dataConUnivTyVars. (See #22167 for what goes wrong if tyConTyVars is used.)