Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
trueName :: String -> Name -> Q Name Source
Scrapes a qualified Name
out from a point-of-entry that you do have
access to. The first String
argument is either the nameBase
―or
fully-qualified―part of the required Name
, while the second is some
other Name
that contains the required Name
in its type or
declaration.
Note that since GHC
does not currently return the RHS of function definitons,
trueName
cannot obtain the Name
for an unexported function. The only
workaround seems to involve copypasta. D:
Check the included examples.
quasiName :: QuasiQuoter Source
QuasiQuoter
interface to trueName
. Accepts two or more
corresponding argument tokens: first should be sans ""
-quotes; the
namespace for the second is denoted in the usual TH syntax of either
a single '
or double ''
prefix.
Extra tokens are assigned as variable names in a Pat
context. Exp
and
Type
are always created with ConE
and ConT
respectively, so this is
not quite as flexible as trueName
.