Best way to consume public API of Haskell package?

I’m toying with a project that would involve generating bindings to Haskell packages. What’s the best way to get some sort of description of the exported API of a Haskell module, or better yet a list of such descriptions for all exposed modules in a published package? I don’t care about documentation, but I do care about the types of functions and instances, the kinds and constructors/members of types and classes, and the nature of re-exports from other modules.

Ideas I’ve had but not started pursuing yet, because none of them seem all that easy:

  • Scrape Haddock files
  • Parse .hi files somehow
  • Write an LSP client that sends a large number of requests to an HLS to assemble the big picture I want

But surely someone has done something like this before me?

hiedb: Generates a references DB from .hie files maybe?

2 Likes

Oh, that looks promising, thanks!

Yep, hie files are designed pretty much to be consumed for exactly this sort of purpose!