Qualified names in TH?

Edward Kmett ekmett at gmail.com
Tue Mar 17 05:01:11 UTC 2015

Using {-# LANGUAGE TemplateHaskell #-} you can use 'foo and ''Foo to get
access to the names in scope in the module that is building the splice,
rather than worrying about what names are in scope in the module the code
gets spliced into.


On Mon, Mar 16, 2015 at 10:54 PM, J. Garrett Morris <Garrett.Morris at ed.ac.uk
> wrote:

> I'm trying to write some Template Haskell code that (among other
> things) manipulates IntSets.  So, for example, I'd like a splice to
> generate a call to Data.IntSet.fromList.  However, I'm not sure how
> IntSet will be imported in the target module.  Is there a way to
> resolve the fully qualified name (or similar) to a TH Name, without
> having to know how it's imported in the splicing module?  (The obvious
> approach---mkName "Data.IntSet.fromList"---seems not to work in GHC
> 7.8.)
> Thanks!
>  /g
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20150317/702ac9f6/attachment.html>

More information about the Glasgow-haskell-users mailing list