
Hello, I have a case in which I wish to parse a hi file to extract the addDependentFile section created by template haskell. I found the function `readBinIface :: CheckHiWay -> TraceBinIFaceReading -> FilePath -> TcRnIf a b ModIface` https://downloads.haskell.org/~ghc/7.10.2/docs/html/libraries/ghc-7.10.2/Bin... I want to use the ModIface type to extract the mi_usages where I believe I will find the list of dependent files. The issue is that I can't extract a value of type ModIface due to the strict dependence on Env of values that are related to this. I don't understand what env is and despite reading about the docs extensively I can't find a function explaining how to work with the env value or how to generate one. The closest thing I found was in TcRnMonad.getTopEnv but even that is cryptic. Could I get some help. All in all, I just want to get the addDependFile section from a hi file.

It is a bit hard to parse your question, but it sounds like you are trying to figure out how to run a value in the 'TcRnIf' monad? In that case, initIfaceCheck will be sufficient for your needs. Assuming that you're operating in the Ghc monad, you should do something like: do hsc_env <- getSession iface <- liftIO $ initIfaceCheck hsc_env (readBinIface ...) ... You might also consider using 'readIface' instead of 'readBinIface'. Edward Excerpts from Njagi Mwaniki's message of 2015-08-16 14:08:40 -0700:
Hello,
I have a case in which I wish to parse a hi file to extract the addDependentFile section created by template haskell.
I found the function `readBinIface :: CheckHiWay -> TraceBinIFaceReading -> FilePath -> TcRnIf a b ModIface` https://downloads.haskell.org/~ghc/7.10.2/docs/html/libraries/ghc-7.10.2/Bin...
I want to use the ModIface type to extract the mi_usages where I believe I will find the list of dependent files.
The issue is that I can't extract a value of type ModIface due to the strict dependence on Env of values that are related to this. I don't understand what env is and despite reading about the docs extensively I can't find a function explaining how to work with the env value or how to generate one. The closest thing I found was in TcRnMonad.getTopEnv but even that is cryptic. Could I get some help.
All in all, I just want to get the addDependFile section from a hi file.
participants (2)
-
Edward Z. Yang
-
Njagi Mwaniki