[Template-haskell] Accessing module imports in TH

Simon Peyton-Jones simonpj at microsoft.com
Mon Dec 12 11:16:29 EST 2005

Currently no.  

Asking whether "x" or "M.x" is in scope would be quite easy to
implement, although it doesn't exist at the moment.

Hmm.  Actually I think you could do 
	qRecover (qreify (mkName "M.x"))

to get the effect, couldn't you?  the reify will fail if the name isn't
in scope, but you can catch the failure with the recover.

Asking what is *exported* would be harder.  Ghc doesn't process the
export list until after processing all top-level splices, because the
things to be exported might not be in scope until then.


| -----Original Message-----
| From: template-haskell-bounces at haskell.org
[mailto:template-haskell-bounces at haskell.org] On
| Behalf Of Robin Bate Boerop
| Sent: 11 December 2005 18:10
| To: template-haskell at haskell.org
| Subject: [Template-haskell] Accessing module imports in TH
| Is there a way to determine within Template Haskell code at compile
| time whether the module being compiled imports particular functions?
| Also, is there a way to obtain a list of function names exported by
| the module being compiled?
| --
| Robin Bate Boerop
| http://robin.bateboerop.name
| _______________________________________________
| template-haskell mailing list
| template-haskell at haskell.org
| http://www.haskell.org/mailman/listinfo/template-haskell

More information about the template-haskell mailing list