Moduleghc-9.10.3GHC2021
GHC.Tc.Deriv.Generics
The deriving code for the Generic class
- 1 type
- 5 values
- Packageghc-9.10.3
- Exports6
- LanguageGHC2021
- LicenceBSD-3-Clause
- SourceGenerics.hs
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.)