RE: pprDec bug
Duncan Coutts <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.template |
|---|---|
| Message-ID | <1085061401.7023.12.camel@localhost> |
On Thu, 2004-05-20 at 09:11, Simon Peyton-Jones wrote: > 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? Right, sometimes you don't have any information so there would have to be two functions on use a Maybe or something. We get that argument from another Quasi class method, like we've already got qCurrentModule that tells us the name, we add one that returns some opaque package of info that at least tells us which modules are in scope. So then you could have pprDecQ :: Dec -> Q String pprDecQ dec = do env <- qCurrentModuleImports pprDecWithEnv env dec Ok, I'll admit, it's not worth the effort. :-) Duncan