Accessing 'Annotations' of modules in external packages

Ranjit Jhala jhala at cs.ucsd.edu
Wed Apr 18 21:01:08 UTC 2018


Hi all,

I'm looking for some help using the GHC API to

access the 'Annotations' (created using the 'ANN'

mechanism) within modules of *external* packages

i.e. non-home modules.Currently I'm using

  hscEPS :: HscEnv -> IO ExternalPackageState

and then using the field

  eps_PIT :: !PackageIfaceTable

and from there, accessing the

  mi_anns :: [IfaceAnnotation]

field of the

  data ModIface

stored in the PackageIfaceTable but this ends in an unfortunate:

```
panic! (the 'impossible' happened)
  (GHC version 8.2.2 for x86_64-apple-darwin):
    No mi_anns in PIT

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
```

Perhaps this is because, as the documentation for `mi_anns` says:

   Annotations NOT STRICT! we read this field lazily from the interface file

but I am not sure how to proceed at this point? Do I need a _different_
HscEnv? Or perhaps I need to set up/initialize the HscEnv separately?

Any pointers would be most welcome!

Thanks!

Ranjit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20180418/82cb540f/attachment.html>


More information about the Glasgow-haskell-users mailing list