GHC.Syb.Instances provides instances of Data/Typeable for Ghc Api types, using standalone deriving.
Most instances are standard; to provide Data
instances
abstract types, we use one of two schemes:
- no traversal:
SrcSpan
,Module
,ModuleName
,OccName
,Name
,FastString
,DataCon
,Var
,TyCon
,Class
abstractConstr n = mkConstr (abstractDataType n) ({abstract:++n++}) [] Prefix abstractDataType n = mkDataType n [abstractConstr n]
instance Data SrcSpan where -- don't traverse? toConstr _ = abstractConstr SrcSpan gunfold _ _ = error gunfold dataTypeOf _ = mkNoRepType SrcSpan
instance Data NameSet where
gfoldl k z s = z mkNameSet k
nameSetToList s -- traverse abstractly
toConstr _ = abstractConstr NameSet
gunfold _ _ = error gunfold
dataTypeOf _ = mkNoRepType NameSet
Please report any issues, either with these abstract instances or with these modules going out of sync with GHC head, to the package maintainer.