
#8488: Annotations should not distinguish type and value -------------------------------------+------------------------------------ Reporter: simonpj | Owner: errge Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by errge): I looked into this today, but I got stuck. The issue is two fold. When doing the `HsDecls` change things almost work out, except for prettyprinting, because the current ppr code looks like this: {{{ pprAnnProvenance (ValueAnnProvenance name) = ptext (sLit "ANN") <+> ppr name pprAnnProvenance (TypeAnnProvenance name) = ptext (sLit "ANN type") <+> ppr name }}} So we use `ValueAnnProvenance` vs `TypeAnnProvenance` to decide if we have to print the type keyword after ANN. I tried to add HasOccName constraint at the pretty printer (because for an OccName we know the namespace), but that gets out of hand very quickly, since everywhere we just assume OutputableBndr now. And I was unsure at that point if it's feasible or not to add everywhere (`HsExpr`, `HsDecls`, etc.) HasOccName besides OutputableBndr. The another issue is on the template haskell side. Template Haskell `OccName` is just a `String`, not a `(String, NameSpace)` (maybe I should fix that, btw?). To compensate this mistake we have some heuristics in `TcSplice` to convert TH names to compiler names. Unfortunately this means that after the proposed change if the user has `data X = X`, it would be very hard for the user to put an annotation on the type and on the constructor both. They would have to resort to `NameG`s which are a bit hard to create and not straightforward at all. How should I go forward with this issues? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8488#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler