true-name-0.0.0.0: Template Haskell hack to violate another module's abstractions

Safe HaskellNone
LanguageHaskell2010

Unsafe.TrueName

Synopsis

Documentation

trueName :: String -> Name -> Q Name Source

Scrapes a qualified Name out from a point-of-entry that you do have access to. First argument is the nameBase part of the required Name, while the second is some other Name that contains the required Name in its type or declaration.

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.