haskell / haddock

Haskell Documentation Tool
www.haskell.org/haddock/
BSD 2-Clause "Simplified" License
361 stars 241 forks source link

Use ghc-lib-parser instead of ghc #1294

Open kozross opened 3 years ago

kozross commented 3 years ago

Currently, we use the ghc library, which chains us to a specific GHC version. However, ghc-lib-parser provides the exact same (as far as I can tell) interface, and would decouple us from GHC versioning concerns (at least by a considerable margin). Is there any reason why we couldn't do this?

alanz commented 3 years ago

Perhaps reconsider this after https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4778 lands?

kozross commented 3 years ago

@alanz I'm not as familiar with GHC's (or Haddock's) innards, so maybe I'm missing something, but won't that only land in the next release of GHC? That's 9.2 as far as I can tell, which is quite a while away at best. Secondly, how will this change the problem? ghc is the version-chained thing, and the MR is to the compiler itself.

poscat0x04 commented 3 years ago

Haddock still needs to use the GHC API for some non-parsing stuff right?

harpocrates commented 3 years ago

Haddock still needs to use the GHC API for some non-parsing stuff right?

Yes. At the very least, Haddock needs to be able to construct type signatures of top-level declarations for which the user did not specify a type signature. Doing that means using GHC in some way to reconstruct the type. Some other slightly less obvious places GHC gets used in Haddock:

kozross commented 3 years ago

@poscat0x04 @harpocrates Is this functionality not coming from ghc or not available in ghc-lib-parser?

Ericson2314 commented 3 years ago

Anything to do with type checking probably isn't in ghc-lib-parser. The long-term goal of https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4778 is to make GHC actually modular, so rather than dealing with funny plugins and funny wrapper libs, we can just have a bunch of libraries, combined normally, just like the rest of the Haskell eocsystem.