diff options
author | Alexander Biehl <alexbiehl@gmail.com> | 2017-08-06 13:18:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-06 13:18:02 +0200 |
commit | f1d326b53fbed5d37f2a83c66e73dbbc94a4354f (patch) | |
tree | d798776c519fb21c4e26a6e604cd0d1cee6fa05d /haddock-api/src/Haddock.hs | |
parent | a677f1592d292a422b9a8d681b0b63a9af611722 (diff) |
Provide --show-interface option to dump interfaces (#645)
* WIP: Provide --show-interface option to dump interfaces
Like ghcs own --show-iface this flag dumps a binary interface file to
stdout in a human (and machine) readable fashion. Currently it uses
json as output format.
* Fill all the jsonNull stubs
* Rework Bifunctor instance of DocH, update changelog and documentation
* replace changelog, bring DocMarkupH doc back
* Update CHANGES.md
* Update CHANGES.md
* Move Control.Arrow up
It would result in unused import if the Bifunctor instance is not generated.
Diffstat (limited to 'haddock-api/src/Haddock.hs')
-rw-r--r-- | haddock-api/src/Haddock.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs index 57ea5fea..554cb416 100644 --- a/haddock-api/src/Haddock.hs +++ b/haddock-api/src/Haddock.hs @@ -32,6 +32,7 @@ import Haddock.Backends.LaTeX import Haddock.Backends.Hoogle import Haddock.Backends.Hyperlinker import Haddock.Interface +import Haddock.Interface.Json import Haddock.Parser import Haddock.Types import Haddock.Version @@ -68,6 +69,7 @@ import System.Directory (doesDirectoryExist) import GHC hiding (verbosity) import Config import DynFlags hiding (projectVersion, verbosity) +import ErrUtils import Packages import Panic (handleGhcException) import Module @@ -164,6 +166,11 @@ haddockWithGhc ghc args = handleTopExceptions $ do dflags <- getDynFlags + forM_ (optShowInterfaceFile flags) $ \path -> liftIO $ do + mIfaceFile <- readInterfaceFiles freshNameCache [(("", Nothing), path)] + forM_ mIfaceFile $ \(_, ifaceFile) -> do + putMsg dflags (renderJson (jsonInterfaceFile ifaceFile)) + if not (null files) then do (packages, ifaces, homeLinks) <- readPackagesAndProcessModules flags files |