Quasi quoting and global names (for haskell-src-exts-qq)

Geoffrey Mainland mainland at apeiron.net
Mon Feb 18 21:28:10 CET 2013

I believe I fixed this problem in Language.Haskell.TH.Quote for the
7.4.1 release. The fix is in revision c4c250 of the template-haskell


On 02/18/2013 03:11 PM, L Corbijn wrote:
> Hello,
> In the haskell-src-exts quasi quoter there is some code to convert all
names in `dataToQa` to global names. The reasoning is according to the
> -- | The generic functions in 'Language.Haskell.TH.Quote' don't use global
> -- names for syntax constructors. This has the unfortunate effect of
> -- quotation when the haskell-src-exts syntax module is imported
> -- The solution is to set the flavour of all names to 'NameG'.
> qualify :: Name -> Name
> -- Need special cases for constructors used in string literals. Assume
> -- all else is a datatype defined in Syntax module of haskell-src-exts.
> qualify n | ":" <- nameBase n = '(:)
> {- snip: quite some excluded constructors -}
> | otherwise = Name (mkOccName (nameBase n)) flavour
> {- snip: some code for the flavour -}
> For the full source code see [1]. When fixing the pattern quasi quoter
this qualification caused a long error (when using the quasi quoter). So
in a simple attempt to fix it I replaced `qualify` with `id` and it all
> Now assuming that the qualification code was needed for some past
version of GHC I would like to make the implementation dependent on the
version of GHC. The only problem is that I haven't found the right
version of GHC where this behaviour changed. Does somebody know at what
version it was needed?
> Greetings,
> Lars Corbijn
> [1] http://hackage.haskell.org/package/haskell-src-exts-qq-0.6.1

More information about the Glasgow-haskell-users mailing list