Serialize docstrings to ifaces, display them with new GHCi :doc command
authorSimon Jakobi <simon.jakobi@gmail.com>
Mon, 4 Jun 2018 21:51:03 +0000 (17:51 -0400)
committerBen Gamari <ben@smart-cactus.org>
Mon, 4 Jun 2018 21:56:57 +0000 (17:56 -0400)
commit85309a3cda367425cca727dfa45e5e6c63b47391
tree0a4aff565a1e34843cbb178707971f86786d939f
parentaa77c602e910cb9a4e17022464c0341fd731f3e0
Serialize docstrings to ifaces, display them with new GHCi :doc command

If `-haddock` is set, we now extract docstrings from the renamed ast
and serialize them in the .hi-files.

This includes some of the changes from D4749 with the notable
exceptions of the docstring lexing and renaming.

A currently limited and experimental GHCi :doc command can be used
to display docstrings for declarations.

The formatting of pretty-printed docstrings is changed slightly,
causing some changes in testsuite/tests/haddock.

Test Plan: ./validate

Reviewers: alexbiehl, hvr, gershomb, harpocrates, bgamari

Reviewed By: alexbiehl

Subscribers: rwbarton, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4758
42 files changed:
compiler/deSugar/Desugar.hs
compiler/deSugar/ExtractDocs.hs [new file with mode: 0644]
compiler/ghc.cabal.in
compiler/hsSyn/HsDoc.hs
compiler/iface/LoadIface.hs
compiler/iface/MkIface.hs
compiler/main/GHC.hs
compiler/main/HscTypes.hs
compiler/main/InteractiveEval.hs
compiler/typecheck/TcRnMonad.hs
docs/users_guide/8.6.1-notes.rst
docs/users_guide/ghci.rst
ghc/GHCi/UI.hs
mk/config.mk.in
testsuite/tests/haddock/haddock_examples/haddock.Test.stderr
testsuite/tests/haddock/should_compile_flag_haddock/T11768.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA014.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA015.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA016.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA018.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA019.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA020.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA021.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA023.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA024.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA025.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA026.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA027.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA028.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA029.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA030.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA031.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA032.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA034.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA035.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA036.stderr
testsuite/tests/haddock/should_compile_flag_haddock/haddockA037.stderr
testsuite/tests/showIface/DocsInHiFile.hs [new file with mode: 0644]
testsuite/tests/showIface/DocsInHiFile0.stdout [new file with mode: 0644]
testsuite/tests/showIface/DocsInHiFile1.stdout [new file with mode: 0644]
testsuite/tests/showIface/Makefile
testsuite/tests/showIface/all.T