[Template-haskell] pprDec bug

Simon Peyton-Jones simonpj at microsoft.com
Thu May 20 10:11:28 EDT 2004


That would make sense for stuff that was printed by GHC itself, but what
argument would you like to give to ppr
	pprDec :: ??? -> Dec -> Doc

The ??? is presumably some specification for "what is in scope in this
module".  What type is this?  Since you, the programmer, are calling it,
where are you going to get that argument from?


Where GHC prints stuff (e.g. -ddump-splices), life would be easier.

Simon

| -----Original Message-----
| From: Duncan Coutts [mailto:duncan.coutts at worcester.oxford.ac.uk]
| Sent: 19 May 2004 10:31
| To: Simon Peyton-Jones
| Cc: Template Haskell List
| Subject: RE: [Template-haskell] pprDec bug
| 
| On Wed, 2004-05-19 at 08:44, Simon Peyton-Jones wrote:
| > | Is there an easy way to transform the declaration to use the
| > | short forms of type names, e.g. "Int" instead of "GHC.Base:Int"?
| >
| > That's harder, because it's not clear what qualifications to omit.
All?
| > But then the program might be ambiguous.  I guess this is so you can
| > feed it back into GHC, right?  You can always import GHC.Base,
| > and then you'll be fine.
| 
| How about a pretty printer that is given a module context so is can
| print the least-qualified identifiers possible given the identifiers
in
| scope in that module. I guess this is what ghc does when it prints its
| error messages.
| 
| eg (in the Q monad):
| module <- currentModule
| pprExpInModuleContext module
| 
| Then not only will the code be valid to feed back to the compiler, but
| it'll also be readable! (I've been looking at too much machine
generated
| code recently :-) )
| 
| Duncan



More information about the template-haskell mailing list