Teach TemplateHaskell to generate less eye-hurting names
If you look at the Haddocks for, e.g., the
singletons package, one sees dozens of signatures containing unsightly names containing long integers. For instance, in the equation list for
Data.Singletons.Prelude.Either.IsLeft we have
IsLeft (Left _z_6989586621679437436) = TrueSym0 IsLeft (Right _z_6989586621679437439) = FalseSym0
For definitions with lots of variables things quickly become unreadable.
These names appear this way because they are generated by TemplateHaskell's
newName function. This name is ultimately converted to a GHC
System name by
Names are then pretty-printed including their uniques (see
Name.pprSystem). I'm not sure I see the rationale for this. Surely if the names are tidied properly (e.g. using
TyConRep.tidyType) there should be no need for the unique suffix.