How to load & parse an HI (interface) file?

Brandon Allbery allbery.b at
Sat Dec 2 20:34:27 UTC 2017

I would be cautious about using the ghc-api hi file interfaces; hi files
turn out to interact with a lot of low-level parts in complex ways (even to
the extent that they're a large part of why ghc can't parallelize builds
itself and attempts to change that have mostly failed).

But if you must do this, you *really* want to have ready to hand ---
and go through it first so you have some idea of how it works; much of it
is links to the lower level details (often straight into the source).

On Sat, Dec 2, 2017 at 10:59 AM, Saurabh Nanda <saurabhnanda at>

> (GHC newbie alert -- is this the right mailing list for these kind of
> questions?)
> I"m writing some code to figure out all the instances of particular
> type-classes and after exploring a lot of options (hlint, haskell-src-exts,
> annotations, doctests, etc), I realized that the compiler had already
> figured it out and written it to disk for me!
> More digging led me to
> LoadIface.html#v:loadSrcInterface after which I got stuck. How does one
> call this function? Specifically:
> * What is SDoc and how to construct a reasonable value for this argument?
> * IsBootInterface would mostly be False, right?
> * What does `Maybe FastString` represent and how does one construct it?
> * Finally how does one evaluate the resulting monadic action to get access
> to the underlying `ModIface`?
> -- Saurabh.
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at

brandon s allbery kf8nh                               sine nomine associates
allbery.b at                                  ballbery at
unix, openafs, kerberos, infrastructure, xmonad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list