[Git][ghc/ghc][master] haddock: include package info with --show-interface

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu Aug 22 03:16:51 UTC 2024


Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
6fde3685 by Marcin Szamotulski at 2024-08-21T23:15:39-04:00
haddock: include package info with --show-interface

- - - - -


2 changed files:

- utils/haddock/CHANGES.md
- utils/haddock/haddock-api/src/Haddock/Interface/Json.hs


Changes:

=====================================
utils/haddock/CHANGES.md
=====================================
@@ -5,6 +5,8 @@
 
  * Fix large margin on top of small headings
 
+ * Include `package_info` with haddock's `--show-interface` option.
+
 ## Changes in 2.28.0
  * `hi-haddock` is integrated, which means docstrings are no longer extracted
    through typchecked module results. Instead, docstrings are taken from Haskell


=====================================
utils/haddock/haddock-api/src/Haddock/Interface/Json.hs
=====================================
@@ -21,7 +21,8 @@ import Haddock.Types
 jsonInterfaceFile :: InterfaceFile -> JsonDoc
 jsonInterfaceFile InterfaceFile{..} =
   jsonObject
-    [ ("link_env", jsonMap nameStableString (jsonString . moduleNameString . moduleName) ifLinkEnv)
+    [ ("package_info", jsonPackageInfo ifPackageInfo)
+    , ("link_env", jsonMap nameStableString (jsonString . moduleNameString . moduleName) ifLinkEnv)
     , ("inst_ifaces", jsonArray (map jsonInstalledInterface ifInstalledIfaces))
     ]
 
@@ -53,6 +54,9 @@ jsonHaddockModInfo HaddockModInfo{..} =
     , ("extensions", jsonArray (map (jsonString . show) hmi_extensions))
     ]
 
+jsonPackageInfo :: PackageInfo -> JsonDoc
+jsonPackageInfo = jsonString . ppPackageInfo
+
 jsonMap :: (a -> String) -> (b -> JsonDoc) -> Map a b -> JsonDoc
 jsonMap f g = jsonObject . map (f *** g) . Map.toList
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6fde368503875ce8485b8d939093102a9f2a09b8

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6fde368503875ce8485b8d939093102a9f2a09b8
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240821/5f1177c8/attachment-0001.html>


More information about the ghc-commits mailing list