+-- gensym a list of type variables and enter them into the meta environment;
+-- the computations passed as the second argument is executed in that extended
+-- meta environment and gets the *original* names as an argument
+--
+addTyVarBinds :: Name -- type constructor for 'a'
+ -> [HsTyVarBndr Name] -- the binders to be added
+ -> ([Core String] -> DsM (Core (M.Q a))) -- action in the ext env
+ -> DsM (Core (M.Q a))
+addTyVarBinds resTyName tvs m =
+ do
+ let names = map hsTyVarName tvs
+ freshNames <- mkGenSyms names
+ term <- addBinds freshNames $ do
+ bndrs <- mapM lookupBinder names
+ m bndrs
+ wrapGenSyns resTyName freshNames term
+