Skip to content

reify RHS of "value" variable

According to the documentation, when reifying value variables "returning the RHS has not yet been implemented because of lack of interest". I'd like to formally request interest since I don't see a ticket here (may have missed it).

My motivating example is to make source available for documentation and better error messages. Something like:

printSource :: Name -> Q Exp
printSource n = do
    VarI _ _ (Just dec) <- reify n
    lift $ pprint dec

foo x = x * 2
fooSource = $(printSource 'foo) -- === "\x_0 -> x_0 GHC.Num.* 2"

How significant of a change is this? I could take a pass at it if pointed to the relevant bits, having not contributed to GHC before.

Trac metadata
Trac field Value
Version 8.2.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Template Haskell
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information