Template Haskellers Consider this reify (mkName "T") Do we get the data constructor T or the type constructor T? For in-scope top-level things we can say reify 'T reify ''T to distinguish, but currently there's no way to distinguish for dynamically scoped names built with mkName. Clearly a global Name, one made by 'T or ''T, keeps track of its own name space. An obvious possibility would be to make all Names do so. So then one would have mkVName :: String -> Name -- variables and data constructors mkTName :: String -> Name -- types, classes, and type variables Dually, one could have name-space predicates isVarName, isDcName, isTcName, isTvName :: Name -> Bool which said if a Name described a variable, datacon, tycoon, tyvar repectively. (mkVName would use the capitalisation convention to decide whether the Name was a datacon or a variable; similarly mkTName.) One advantage of this is that we could get rid of the VarE/ConE distinction, and the VarT/ConT distinction, which would be quite worthwhile, I think. And it would fix the problem I started this message with. But it would mean that the (hopefully few) mkName calls would need to change to mkVName and mkTName. I'm inclined to do this. Any comments? Simon
participants (1)
-
Simon Peyton-Jones