This class exposes the method resolveNames which will perform name resolution for all the fields in a datatype.
Example usage: we define a record that will hold the things we want to look up, using the Wear type family.
For example:
data MyData n
= MyData
{ myClass :: !( Wear n Class )
, myTyCon :: !( Wear n TyCon )
, myDataCon :: !( Wear n DataCon )
, myPromDataCon :: !( Wear n (Promoted DataCon) )
}
deriving stock Generic
deriving ResolveNames
via Generically1 MyDataNow we can specify the names of the things which we want to look up, together with the modules and packages in which they belong:
myNames :: MyData Named
myNames = MyData
{ myClass = QualifiedName "MyClass" "My.Module" ( Just "my-pkg-name" )
, ...
}Then we can call resolveNames:
resolvedNames :: MonadTcPlugin m => m (MyData Resolved)
resolvedNames = resolveNames myNamesThis returns a record containing the looked up things we want,
e.g. myClass :: Class, myPromDataCon :: TyCon, etc.
Instances1ResolveNames
(Generic (f 'Named), Generic (f 'Resolved), GTraversableC ResolveName (Rep (f 'Named)) (Rep (f 'Resolved))) => ResolveNames (Generically1 f)Defined in ghc-tcplugin-api-0.20.1.0 · GHC.TcPlugin.API.Names