GHC has a "--show-iface" option which pretty prints the ".hi" file. Not sure if it works for your use-case but it may be easier to parse the text displayed by this option.


From https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/IfaceFiles --

> This textual format is not particularly designed for machine parsing. Doing so might be possible, but if you
> want to read GHC interface files you are almost certainly better off using the GHC API to do so.

That's the reason why I started investigating the GHC API.

-- Saurabh.