Safe Haskell | None |
---|---|
Language | GHC2021 |
Types and functions for raw and lexed docstrings.
Synopsis
- type HsDoc = WithHsDocIdentifiers HsDocString
- data WithHsDocIdentifiers a pass = WithHsDocIdentifiers {
- hsDocString :: !a
- hsDocIdentifiers :: ![Located (IdP pass)]
- hsDocIds :: WithHsDocIdentifiers a GhcRn -> NameSet
- type LHsDoc pass = Located (HsDoc pass)
- pprHsDocDebug :: Outputable (IdP name) => HsDoc name -> SDoc
- pprWithDoc :: LHsDoc name -> SDoc -> SDoc
- pprMaybeWithDoc :: Maybe (LHsDoc name) -> SDoc -> SDoc
- module GHC.Hs.DocString
- data ExtractedTHDocs = ExtractedTHDocs {
- ethd_mod_header :: Maybe (HsDoc GhcRn)
- ethd_decl_docs :: UniqMap Name (HsDoc GhcRn)
- ethd_arg_docs :: UniqMap Name (IntMap (HsDoc GhcRn))
- ethd_inst_docs :: UniqMap Name (HsDoc GhcRn)
- data DocStructureItem
- = DsiSectionHeading !Int !(HsDoc GhcRn)
- | DsiDocChunk !(HsDoc GhcRn)
- | DsiNamedChunkRef !String
- | DsiExports !Avails
- | DsiModExport !(NonEmpty ModuleName) !Avails
- type DocStructure = [DocStructureItem]
- data Docs = Docs {
- docs_mod_hdr :: Maybe (HsDoc GhcRn)
- docs_exports :: UniqMap Name (HsDoc GhcRn)
- docs_decls :: UniqMap Name [HsDoc GhcRn]
- docs_args :: UniqMap Name (IntMap (HsDoc GhcRn))
- docs_structure :: DocStructure
- docs_named_chunks :: Map String (HsDoc GhcRn)
- docs_haddock_opts :: Maybe String
- docs_language :: Maybe Language
- docs_extensions :: EnumSet Extension
- emptyDocs :: Docs
Documentation
type HsDoc = WithHsDocIdentifiers HsDocString Source #
A docstring with the (probable) identifiers found in it.
data WithHsDocIdentifiers a pass Source #
Annotate a value with the probable identifiers found in it These will be used by haddock to generate links.
The identifiers are bundled along with their location in the source file. This is useful for tooling to know exactly where they originate.
This type is currently used in two places - for regular documentation comments,
with a
set to HsDocString
, and for adding identifier information to
warnings, where a
is StringLiteral
WithHsDocIdentifiers | |
|
Instances
(NFData (IdP pass), NFData a) => NFData (WithHsDocIdentifiers a pass) Source # | |
Defined in GHC.Hs.Doc rnf :: WithHsDocIdentifiers a pass -> () Source # | |
Binary a => Binary (WithHsDocIdentifiers a GhcRn) Source # | |
Defined in GHC.Hs.Doc put_ :: WriteBinHandle -> WithHsDocIdentifiers a GhcRn -> IO () Source # put :: WriteBinHandle -> WithHsDocIdentifiers a GhcRn -> IO (Bin (WithHsDocIdentifiers a GhcRn)) Source # get :: ReadBinHandle -> IO (WithHsDocIdentifiers a GhcRn) Source # | |
Outputable a => Outputable (WithHsDocIdentifiers a pass) Source # | For compatibility with the existing @-ddump-parsed' output, we only show the docstring. Use |
Defined in GHC.Hs.Doc ppr :: WithHsDocIdentifiers a pass -> SDoc Source # | |
(Data pass, Data (IdP pass), Data a) => Data (WithHsDocIdentifiers a pass) Source # | |
Defined in GHC.Hs.Doc gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> WithHsDocIdentifiers a pass -> c (WithHsDocIdentifiers a pass) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (WithHsDocIdentifiers a pass) # toConstr :: WithHsDocIdentifiers a pass -> Constr # dataTypeOf :: WithHsDocIdentifiers a pass -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (WithHsDocIdentifiers a pass)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (WithHsDocIdentifiers a pass)) # gmapT :: (forall b. Data b => b -> b) -> WithHsDocIdentifiers a pass -> WithHsDocIdentifiers a pass # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WithHsDocIdentifiers a pass -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WithHsDocIdentifiers a pass -> r # gmapQ :: (forall d. Data d => d -> u) -> WithHsDocIdentifiers a pass -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> WithHsDocIdentifiers a pass -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> WithHsDocIdentifiers a pass -> m (WithHsDocIdentifiers a pass) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> WithHsDocIdentifiers a pass -> m (WithHsDocIdentifiers a pass) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> WithHsDocIdentifiers a pass -> m (WithHsDocIdentifiers a pass) # | |
(Eq (IdP pass), Eq a) => Eq (WithHsDocIdentifiers a pass) Source # | |
Defined in GHC.Hs.Doc (==) :: WithHsDocIdentifiers a pass -> WithHsDocIdentifiers a pass -> Bool # (/=) :: WithHsDocIdentifiers a pass -> WithHsDocIdentifiers a pass -> Bool # |
hsDocIds :: WithHsDocIdentifiers a GhcRn -> NameSet Source #
Extract a mapping from the lexed identifiers to the names they may correspond to.
pprHsDocDebug :: Outputable (IdP name) => HsDoc name -> SDoc Source #
Print a doc with its identifiers, useful for debugging
pprWithDoc :: LHsDoc name -> SDoc -> SDoc Source #
Pretty print a thing with its doc The docstring will include the comment decorators '-- |', '{-|' etc and will come either before or after depending on how it was written i.e it will come after the thing if it is a '-- ^' or '{-^' and before otherwise.
module GHC.Hs.DocString
data ExtractedTHDocs Source #
Maps of docs that were added via Template Haskell's putDoc
.
ExtractedTHDocs | |
|
data DocStructureItem Source #
A simplified version of IE
.
DsiSectionHeading !Int !(HsDoc GhcRn) | |
DsiDocChunk !(HsDoc GhcRn) | |
DsiNamedChunkRef !String | |
DsiExports !Avails | |
DsiModExport | |
|
Instances
NFData DocStructureItem Source # | |
Defined in GHC.Hs.Doc rnf :: DocStructureItem -> () Source # | |
Binary DocStructureItem Source # | |
Defined in GHC.Hs.Doc put_ :: WriteBinHandle -> DocStructureItem -> IO () Source # put :: WriteBinHandle -> DocStructureItem -> IO (Bin DocStructureItem) Source # get :: ReadBinHandle -> IO DocStructureItem Source # | |
Outputable DocStructureItem Source # | |
Defined in GHC.Hs.Doc ppr :: DocStructureItem -> SDoc Source # |
type DocStructure = [DocStructureItem] Source #
Docs | |
|