Understanding DsMeta module
Jan Stolarek
jan.stolarek at p.lodz.pl
Wed Dec 17 17:29:39 UTC 2014
I'm implementing Template Haskell support for injective type families and I'm struggling to
understand DsMeta module. It seems that all functions in that module delegate their calls to
functions in Language.Haskell.TH.Lib via wired-in names and the `DsMeta.rep2` function. I'm
puzzled by this design and I'd appreciate if someone could explain why things are done this way.
Take this function example:
repPlainTV :: Core TH.Name -> DsM (Core TH.TyVarBndr)
repPlainTV (MkC nm) = rep2 plainTVName [nm]
where `plainTvName` is a name of `Language.Haskell.TH.Lib.plainTV`:
plainTV :: Name -> TyVarBndr
plainTV = PlainTV
Why not implement repPlainTV like this: ?
repPlainTV :: Core TH.Name -> DsM (Core TH.TyVarBndr)
repPlainTV (MkC nm) = return $ MkC (TH.PlainTV nm)
Janek
More information about the ghc-devs
mailing list