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

L Corbijn aspergesoepje at gmail.com
Mon Feb 18 16:11:29 CET 2013


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
source:

-- | The generic functions in 'Language.Haskell.TH.Quote' don't use global
-- names for syntax constructors. This has the unfortunate effect of
breaking
-- quotation when the haskell-src-exts syntax module is imported qualified.
-- 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
nearly
-- 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 worked.

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20130218/9807cbe7/attachment.htm>


More information about the Glasgow-haskell-users mailing list