extractDocs Extract docs from renamer output.
This is monadic since we need to be able to read documentation added from
Template Haskell's putDoc, which is stored in tcg_th_docs.
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Moduleghc-9.10.3GHC2021
Extract docs from the renamer output so they can be serialized.
extractDocs Extract docs from renamer output.
This is monadic since we need to be able to read documentation added from
Template Haskell's putDoc, which is stored in tcg_th_docs.
mkDocStructure If we have an explicit export list, we extract the documentation structure from that. Otherwise we use the renamed exports and declarations.
mkDocStructureFromExportList :: ModuleThe current module
-> ImportAvails-> [(LIE GhcRn, Avails)]Explicit export list
-> DocStructureFigure out the documentation structure by correlating the module exports with the located declarations.
getNamedChunks Extract named documentation chunks from the renamed declarations.
If there is no explicit export list, we simply return an empty map since there would be no way to link to a named chunk.
Create decl and arg doc-maps by looping through the declarations. For each declaration, find its names, its subordinates, and its doc strings.
The "OccEnv Name" is the default method environment for this module Ultimately, the a special "defaultMethodOcc" name is used for the signatures on bindings for default methods. Unfortunately, this name isn't generated until typechecking, so it is not in the renamed AST. We have to look it up from the OccEnv parameter constructed from the typechecked AST. See also Note [default method Name] in GHC.Iface.Recomp
subordinates Get all subordinate declarations inside a declaration, and their docs. A subordinate declaration is something like the associate type or data family of a type class.
Extract constructor argument docs from inside constructor decls.
All the sub declarations of a class (that we handle), ordered by source location, with documentation attached if it exists.
Extract function argument docs from inside top-level decls.
Extract function argument docs from inside types.
Extract function argument docs from inside types.
The top-level declarations of a module that we care about, ordered by source location, with documentation attached if it exists.
Take all declarations except pragmas, infix decls, rules from an HsGroup.
Collect docs and attach them to the right declarations.
A declaration may have multiple doc strings attached to it.
This is an example.
Filter out declarations that we don't handle in Haddock
Go through all class declarations and filter their sub-declarations
Was this signature given by the user?
Take a field of declarations from a data structure and create HsDecls using the given constructor
Extracts out individual maps of documentation added via Template Haskell's
putDoc.
Unions together two ArgDocMaps (or ArgMaps in haddock-api), such that two
maps with values for the same key merge the inner map as well.
Left biased so unionArgMaps a b prefers a over b.