template-haskell: Add putDoc, getDoc and friends
This MR is an implementation of @mpickering's comment in #5467
It adds two new functions,
getDoc that can attach documentation to module headers, declarations, function arguments and class/family instances, as well as retrieve it, provided that
Opt_Haddock is enabled.
This part extends
template-haskell and GHC's opt-haddock support, since Haddock doesn't seem to use the .hi files just yet there is a separate patch that integrates this into Haddock at this branch
Things to do:
Stringthe right type for docs?
- Add combinators
Take a closer look at
getDoc(should probably allow it to lookup docs that were added via
- Does that IORef in TcGblEnv need to be released?
- What happens when Opt_Haddock isn't on?
- How does this work with things defined outside of the module?