
Arie Peterson wrote:
I seem to remember that 'reify' cannot be run in the IO monad. IIRC ghci gives a nice error message saying this, so perhaps you can try to execute 'main' from within ghci to corroborate my suspicion.
Yes you're right - ghci gives the error: "Can't do `reify' in the IO monad"
Also, I'm puzzled by the type of reify, because the name "Car" above should surely be both a TyConI and a DataConI so how does this function decide which to return the info about? I expected an extra parameter to determine what namespace to look the name up in.
The preferred way to refer to names that are in scope is by using the quotation mechanism:
'getName is the name of the function 'getName' ''Object is the name of the type 'Object'
This also makes the distinction you rightly wanted.
Thanks, Brian.