#4429: Ability to specify the namespace in mkName
---------------------------------+------------------------------------------
Reporter: reinerp | Owner:
Type: feature request | Status: infoneeded
Priority: normal | Milestone: 7.4.1
Component: Template Haskell | Version: 6.12.3
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Changes (by simonpj):
* status: patch => infoneeded
Comment:
Replying to [comment:14 reinerp]:
> This currently prints {{{["global","local","local","local"]}}}. Should
the first two really give different results?
Well, yes, that's the current deal. '''All''' reify operations consult
the environment at the point of the enclosing ''top-level'' splice. For a
more extreme example, consider
{{{
module M where
funny :: Q Exp
funny = do { Just n <- lookupValueName "f"; varE n }
f :: Int
f = 3
module Top where
import M
me = $(funny)
f :: Bool
f = True
}}}
Here the `lookupValueName` consults the environment at the ''top-level
splice'', which in this case in in module `Top`, not in `M`. So the
expanded code will bind to `Top.f` not to `M.f`.
Doing anything else would be hard, and this is consistent with what
happens for all other reification.
None of this is documented. If I could ask one last favour, would you
feel able to expand (or re-structure) the user manual section about
Template Haskell [http://www.haskell.org/ghc/docs/latest/html/users_guide
/template-haskell.html]? This could range from no-op, through at least
documenting the key operations (like `reify`).
Hmm. A complementary (and perhpas better) alternative would be to look at
the ridiculously scanty Haddock documentation in `Language.Haskell.TH`:
http://www.haskell.org/ghc/docs/latest/html/libraries/template-
haskell-2.6.0.0/Language-Haskell-TH.html. Simply documenting the types
and operations properly would be a huge step forward.
Thanks for considering this. Needless to say I'd be more than happy to
answer queries that arise when doing so.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4429#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs