HORIZON HASKELLDocslts/ghc-10.0.x04404a62026-10-19Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 04404a6 · 2026-10-19

Moduleghc-10.0.0.20260917GHC2024

GHC.HsToCore.Docs

Extract docs from the renamer output so they can be serialized.

Contents
  1. Maybe remove items that export nothing?
  2. Combine sequences of DsiExports?
Synopsis
valueextractDocs
  1. :: MonadIO m
  2. => DynFlags
  3. -> TcGblEnv
  4. -> m (Maybe Docs)
    1. Module header

    2. Docs on top level declarations

    3. Docs on arguments

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.

Maybe remove items that export nothing?

Combine sequences of DsiExports?

valuegetNamedChunks
  1. :: Bool

    Do we have an explicit export list?

  2. -> HsGroup (GhcPass pass)
  3. -> Map String (HsDoc (GhcPass pass))

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.

valuesigNameNoLoc
  1. :: (UnXRec a, HasOccName (IdP a))
  2. => OccEnv (IdP a)
  3. -> Sig a
  4. -> [IdP a]

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

valuecollectDocs :: UnXRec p => [LHsDecl p] -> [(LHsDecl p, [HsDoc p])]

Collect docs and attach them to the right declarations.

A declaration may have multiple doc strings attached to it.

This is an example.

valuemkDecls :: (decl -> hsDecl) -> [GenLocated l decl] -> [GenLocated l hsDecl]

Take a field of declarations from a data structure and create HsDecls using the given constructor