Documentation.Haddock

haddock-api-2.33.0: A documentation-generation tool for Haskell libraries

Copyright | (c) David Waern 2010
License | BSD-like
Maintainer | haddock@projects.haskellorg
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Documentation.Haddock

Contents

- Interface
- Export items & declarations
- Cross-referencing
- Instances
- Documentation comments
- Interface files
- Flags and options
- Error handling
- Program entry point

Description

The Haddock API: A rudimentary, highly experimental API exposing some of the internals of Haddock. Don't expect it to be stable.

Synopsis

- data Interface = Interface {
  - ifaceMod :: !Module
  - ifaceIsSig :: !Bool
  - ifaceInfo :: !(HaddockModInfo Name)
  - ifaceDoc :: !(Documentation Name)
  - ifaceRnDoc :: !(Documentation DocName)
  - ifaceOptions :: [DocOption]
  - ifaceDocMap :: !(DocMap Name)
  - ifaceArgMap :: !(ArgMap Name)
  - ifaceDefMeths :: ![(OccName, Name)]
  - ifaceFixMap :: !(Map Name Fixity)
  - ifaceExportItems :: [ExportItem GhcRn]
  - ifaceRnExportItems :: [ExportItem DocNameI]
  - ifaceExports :: [Name]
  - ifaceVisibleExports :: [Name]
  - ifaceInstances :: [ClsInst]
  - ifaceOrphanDeps :: [Module]
  - ifaceOrphanInstances :: [DocInstance GhcRn]
  - ifaceRnOrphanInstances :: [DocInstance DocNameI]
  - ifaceHaddockCoverage :: (Int, Int)
  - ifaceWarningMap :: WarningMap
  - ifaceHieFile :: !FilePath
  - ifaceDynFlags :: !DynFlags
  }
- data InstalledInterface = InstalledInterface {
  - instMod :: Module
  - instIsSig :: Bool
  - instInfo :: HaddockModInfo Name
  - instDocMap :: DocMap Name
  - instArgMap :: ArgMap Name
  - instDefMeths :: [(OccName, Name)]
  - instExports :: [Name]
  - instVisibleExports :: [Name]
  - instOptions :: [DocOption]
  - instFixMap :: Map Name Fixity
  - instWarningMap :: WarningMap
  - instInstanceLocMap :: Map Name RealSrcSpan
  }
- toInstalledIface :: Interface -> InstalledInterface
- createInterfaces :: [Flag] -> [String] -> IO [Interface]
- processModules :: Verbosity -> [String] -> [Flag] -> [InterfaceFile] -> Ghc ([Interface], LinkEnv)
- data ExportItem name
  - = ExportDecl (XExportDecl name)
  - | ExportNoDecl {
    - expItemName :: !(IdP name)
    - expItemSubs :: [IdP name]
    }
  - | ExportGroup {
    - expItemSectionLevel :: !Int
    - expItemSectionId :: !String
    - expItemSectionText :: !(Doc (IdP name))
    }
  - | ExportDoc !(MDoc (IdP name))
  - | ExportModule !Module
- type DocForDecl name = (Documentation name, FnArgsDoc name)
- type FnArgsDoc name = Map Int (MDoc name)
- type LinkEnv = Map Name Module
- data DocName
  - = Documented Name Module
  - | Undocumented Name
- type DocInstance name = (InstHead name, Maybe (MDoc (IdP name)), Located (IdP name), Maybe Module)
- data InstHead name
- type Doc id = DocH (Wrap (ModuleName, OccName)) (Wrap id)
- type MDoc id = MetaDoc (Wrap (ModuleName, OccName)) (Wrap id)
- data DocH mod id
  - = DocEmpty
  - | DocAppend (DocH mod id) (DocH mod id)
  - | DocString String
  - | DocParagraph (DocH mod id)
  - | DocIdentifier id
  - | DocIdentifierUnchecked mod
  - | DocModule (ModLink (DocH mod id))
  - | DocWarning (DocH mod id)
  - | DocEmphasis (DocH mod id)
  - | DocMonospaced (DocH mod id)
  - | DocBold (DocH mod id)
  - | DocUnorderedList [DocH mod id]
  - | DocOrderedList [(Int, DocH mod id)]
  - | DocDefList [(DocH mod id, DocH mod id)]
  - | DocCodeBlock (DocH mod id)
  - | DocHyperlink (Hyperlink (DocH mod id))
  - | DocPic Picture
  - | DocMathInline String
  - | DocMathDisplay String
  - | DocAName String
  - | DocProperty String
  - | DocExamples [Example]
  - | DocHeader (Header (DocH mod id))
  - | DocTable (Table (DocH mod id))
- data Example = Example {
  - exampleExpression :: String
  - exampleResult :: [String]
  }
- data Hyperlink id = Hyperlink {
  - hyperlinkUrl :: String
  - hyperlinkLabel :: Maybe id
  }
- type DocMarkup id a = DocMarkupH (Wrap (ModuleName, OccName)) id a
- data DocMarkupH mod id a = Markup {
  - markupEmpty :: a
  - markupString :: String -> a
  - markupParagraph :: a -> a
  - markupAppend :: a -> a -> a
  - markupIdentifier :: id -> a
  - markupIdentifierUnchecked :: mod -> a
  - markupModule :: ModLink a -> a
  - markupWarning :: a -> a
  - markupEmphasis :: a -> a
  - markupBold :: a -> a
  - markupMonospaced :: a -> a
  - markupUnorderedList :: [a] -> a
  - markupOrderedList :: [(Int, a)] -> a
  - markupDefList :: [(a, a)] -> a
  - markupCodeBlock :: a -> a
  - markupHyperlink :: Hyperlink a -> a
  - markupAName :: String -> a
  - markupPic :: Picture -> a
  - markupMathInline :: String -> a
  - markupMathDisplay :: String -> a
  - markupProperty :: String -> a
  - markupExample :: [Example] -> a
  - markupHeader :: Header a -> a
  - markupTable :: Table a -> a
  }
- data Documentation name = Documentation {
  - documentationDoc :: Maybe (MDoc name)
  - documentationWarning :: Maybe (Doc name)
  }
- type ArgMap a = Map Name (Map Int (MDoc a))
- type WarningMap = Map Name (Doc Name)
- type DocMap a = Map Name (MDoc a)
- data HaddockModInfo name = HaddockModInfo {
  - hmi_description :: Maybe (Doc name)
  - hmi_copyright :: Maybe String
  - hmi_license :: Maybe String
  - hmi_maintainer :: Maybe String
  - hmi_stability :: Maybe String
  - hmi_portability :: Maybe String
  - hmi_safety :: Maybe String
  - hmi_language :: Maybe Language
  - hmi_extensions :: [Extension]
  }
- markup :: DocMarkupH mod id a -> DocH mod id -> a
- data InterfaceFile = InterfaceFile {
  - ifLinkEnv :: LinkEnv
  - ifPackageInfo :: PackageInfo
  - ifInstalledIfaces :: [InstalledInterface]
  }
- readInterfaceFile :: NameCache -> FilePath -> Bool -> IO (Either String InterfaceFile)
- freshNameCache :: IO NameCache
- data Flag
  - = Flag_BuiltInThemes
  - | Flag_CSS String
  - | Flag_ReadInterface String
  - | Flag_DumpInterface String
  - | Flag_ShowInterface String
  - | Flag_Heading String
  - | Flag_Html
  - | Flag_Hoogle
  - | Flag_Lib String
  - | Flag_OutputDir FilePath
  - | Flag_Prologue FilePath
  - | Flag_SourceBaseURL String
  - | Flag_SourceModuleURL String
  - | Flag_SourceEntityURL String
  - | Flag_SourceLEntityURL String
  - | Flag_WikiBaseURL String
  - | Flag_BaseURL String
  - | Flag_WikiModuleURL String
  - | Flag_WikiEntityURL String
  - | Flag_LaTeX
  - | Flag_LaTeXStyle String
  - | Flag_QuickJumpIndex
  - | Flag_HyperlinkedSource
  - | Flag_SourceCss String
  - | Flag_Mathjax String
  - | Flag_Help
  - | Flag_Verbosity String
  - | Flag_Version
  - | Flag_CompatibleInterfaceVersions
  - | Flag_InterfaceVersion
  - | Flag_BypassInterfaceVersonCheck
  - | Flag_UseContents String
  - | Flag_GenContents
  - | Flag_UseIndex String
  - | Flag_GenIndex
  - | Flag_IgnoreAllExports
  - | Flag_HideModule String
  - | Flag_ShowModule String
  - | Flag_ShowAllModules
  - | Flag_ShowExtensions String
  - | Flag_OptGhc String
  - | Flag_GhcLibDir String
  - | Flag_GhcVersion
  - | Flag_PrintGhcPath
  - | Flag_PrintGhcLibDir
  - | Flag_NoWarnings
  - | Flag_UseUnicode
  - | Flag_NoTmpCompDir
  - | Flag_Qualification String
  - | Flag_PrettyHtml
  - | Flag_NoPrintMissingDocs
  - | Flag_PackageName String
  - | Flag_PackageVersion String
  - | Flag_Reexport String
  - | Flag_SinceQualification String
  - | Flag_IgnoreLinkSymbol String
  - | Flag_ParCount (Maybe Int)
  - | Flag_TraceArgs
  - | Flag_OneShot String
  - | Flag_NoCompilation
- data DocOption
  - = OptHide
  - | OptPrune
  - | OptIgnoreExports
  - | OptNotHome
  - | OptShowExtensions
  - | OptPrintRuntimeRep
  - | OptRedactTypeSyns
- data HaddockException
  - = HaddockException String
  - | WithContext [String] SomeException
- haddock :: [String] -> IO ()
- haddockWithGhc :: (forall a. [Flag] -> Ghc a -> IO a) -> [String] -> IO ()
- getGhcDirs :: [Flag] -> IO (Maybe FilePath, Maybe FilePath)
- withGhc :: [Flag] -> Ghc a -> IO a

# Interface

data Interface Source #

`Interface` holds all information used to render a single Haddock page. It represents the interface of a module. The core business of Haddock lies in creating this structure. Note that the record contains some fields that are only used to create the final record, and that are not used by the backends.

Constructors

Interface |
Fields ifaceMod :: !Module The module behind this interface. ifaceIsSig :: !Bool Is this a signature? ifaceInfo :: !(HaddockModInfo Name) Textual information about the module. ifaceDoc :: !(Documentation Name) Documentation header. ifaceRnDoc :: !(Documentation DocName) Documentation header with cross-reference information. ifaceOptions :: [DocOption] Haddock options for this module (prune, ignore-exports, etc). ifaceDocMap :: !(DocMap Name) Documentation of declarations originating from the module (including subordinates). ifaceArgMap :: !(ArgMap Name) ifaceDefMeths :: ![(OccName, Name)] The names of all the default methods for classes defined in this module ifaceFixMap :: !(Map Name Fixity) ifaceExportItems :: [ExportItem GhcRn] ifaceRnExportItems :: [ExportItem DocNameI] ifaceExports :: [Name] All names exported by the module. ifaceVisibleExports :: [Name] All "visible" names exported by the module. A visible name is a name that will show up in the documentation of the module. Names from modules that are entirely re-exported don't count as visible. ifaceInstances :: [ClsInst] Instances exported by the module. ifaceOrphanDeps :: [Module] The list of modules to check for orphan instances if this module is imported. ifaceOrphanInstances :: [DocInstance GhcRn] Orphan instances ifaceRnOrphanInstances :: [DocInstance DocNameI] ifaceHaddockCoverage :: (Int, Int) The number of haddockable and haddocked items in the module, as a tuple. Haddockable items are the exports and the module itself. ifaceWarningMap :: WarningMap Warnings for things defined in this module. ifaceHieFile :: !FilePath Tokenized source code of module (available if Haddock is invoked with source generation flag). ifaceDynFlags :: !DynFlags

data InstalledInterface Source #

A subset of the fields of `Interface` that we store in the interface files.

Constructors

InstalledInterface |
Fields instMod :: Module The module represented by this interface. instIsSig :: Bool Is this a signature? instInfo :: HaddockModInfo Name Textual information about the module. instDocMap :: DocMap Name Documentation of declarations originating from the module (including subordinates). instArgMap :: ArgMap Name instDefMeths :: [(OccName, Name)] The names of all the default methods for classes defined in this module instExports :: [Name] All names exported by this module. instVisibleExports :: [Name] All "visible" names exported by the module. A visible name is a name that will show up in the documentation of the module. instOptions :: [DocOption] Haddock options for this module (prune, ignore-exports, etc). instFixMap :: Map Name Fixity instWarningMap :: WarningMap instInstanceLocMap :: Map Name RealSrcSpan

#### Instances

Instances details

Binary InstalledInterface Source # |
Instance details Defined in Haddock.InterfaceFile Methods put_ :: WriteBinHandle -> InstalledInterface -> IO () Source # put :: WriteBinHandle -> InstalledInterface -> IO (Bin InstalledInterface) Source # get :: ReadBinHandle -> IO InstalledInterface Source #

toInstalledIface :: Interface -> InstalledInterface Source #

Convert an `Interface` to an `InstalledInterface`

createInterfaces Source #

Arguments

:: [Flag] | A list of command-line flags
-> [String] | File or module names
-> IO [Interface] | Resulting list of interfaces

Create `Interface` structures from a given list of Haddock command-line flags and file or module names (as accepted by `haddock` executable). Flags that control documentation generation or show help or version information are ignored.

processModules Source #

Arguments

:: Verbosity | Verbosity of logging to `stdout`
-> [String] | A list of file or module names sorted by module topology
-> [Flag] | Command-line flags
-> [InterfaceFile] | Interface files of package dependencies
-> Ghc ([Interface], LinkEnv) | Resulting list of interfaces and renaming environment

Create `Interface`s and a link environment by typechecking the list of modules using the GHC API and processing the resulting syntax trees.

# Export items & declarations

data ExportItem name Source #

Constructors

ExportDecl (XExportDecl name) | An exported declaration.
ExportNoDecl | An exported entity for which we have no documentation (perhaps because it resides in another package).
Fields expItemName :: !(IdP name) expItemSubs :: [IdP name] Subordinate names.
ExportGroup | A section heading.
Fields expItemSectionLevel :: !Int Section level (1, 2, 3, ...). expItemSectionId :: !String Section id (for hyperlinks). expItemSectionText :: !(Doc (IdP name)) Section heading text.
ExportDoc !(MDoc (IdP name)) | Some documentation.
ExportModule !Module | A cross-reference to another module.

type DocForDecl name = (Documentation name, FnArgsDoc name) Source #

type FnArgsDoc name = Map Int (MDoc name) Source #

Arguments and result are indexed by Int, zero-based from the left, because that's the easiest to use when recursing over types.

# Cross-referencing

type LinkEnv = Map Name Module Source #

Type of environment used to cross-reference identifiers in the syntax.

data DocName Source #

Extends `Name` with cross-reference information.

Constructors

Documented Name Module | This thing is part of the (existing or resulting) documentation. The `Module` is the preferred place in the documentation to refer to.
Undocumented Name | This thing is not part of the (existing or resulting) documentation, as far as Haddock knows.

#### Instances

Instances details

NamedThing DocName Source # |
Instance details Defined in Haddock.Types Methods getOccName :: DocName -> OccName Source # getName :: DocName -> Name Source #
HasOccName DocName Source # |
Instance details Defined in Haddock.Types Methods occName :: DocName -> OccName Source #
Binary DocName Source # |
Instance details Defined in Haddock.InterfaceFile Methods put_ :: WriteBinHandle -> DocName -> IO () Source # put :: WriteBinHandle -> DocName -> IO (Bin DocName) Source # get :: ReadBinHandle -> IO DocName Source #
Outputable DocName Source # | Useful for debugging
Instance details Defined in Haddock.Types Methods ppr :: DocName -> SDoc Source #
OutputableBndr DocName Source # |
Instance details Defined in Haddock.Types Methods pprBndr :: BindingSite -> DocName -> SDoc Source # pprPrefixOcc :: DocName -> SDoc Source # pprInfixOcc :: DocName -> SDoc Source # bndrIsJoin_maybe :: DocName -> JoinPointHood Source #
Eq DocName Source # |
Instance details Defined in Haddock.Types Methods (==) :: DocName -> DocName -> Bool # (/=) :: DocName -> DocName -> Bool #
Data DocName Source # |
Instance details Defined in Haddock.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DocName -> c DocName # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DocName # toConstr :: DocName -> Constr # dataTypeOf :: DocName -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DocName) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DocName) # gmapT :: (forall b. Data b => b -> b) -> DocName -> DocName # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DocName -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DocName -> r # gmapQ :: (forall d. Data d => d -> u) -> DocName -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> DocName -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> DocName -> m DocName # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DocName -> m DocName # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DocName -> m DocName #
type Anno DocName Source # |
Instance details Defined in Haddock.Types type Anno DocName = SrcSpanAnnN

# Instances

type DocInstance name = (InstHead name, Maybe (MDoc (IdP name)), Located (IdP name), Maybe Module) Source #

An instance head that may have documentation and a source location.

data InstHead name Source #

The head of an instance. Consists of a class name, a list of type parameters (which may be annotated with kinds), and an instance type

# Documentation comments

type Doc id = DocH (Wrap (ModuleName, OccName)) (Wrap id) Source #

type MDoc id = MetaDoc (Wrap (ModuleName, OccName)) (Wrap id) Source #

data DocH mod id Source #

Constructors

DocEmpty |
DocAppend (DocH mod id) (DocH mod id) |
DocString String |
DocParagraph (DocH mod id) |
DocIdentifier id |
DocIdentifierUnchecked mod | A qualified identifier that couldn't be resolved.
DocModule (ModLink (DocH mod id)) | A link to a module, with an optional label.
DocWarning (DocH mod id) | This constructor has no counterpart in Haddock markup.
DocEmphasis (DocH mod id) |
DocMonospaced (DocH mod id) |
DocBold (DocH mod id) |
DocUnorderedList [DocH mod id] |
DocOrderedList [(Int, DocH mod id)] |
DocDefList [(DocH mod id, DocH mod id)] |
DocCodeBlock (DocH mod id) |
DocHyperlink (Hyperlink (DocH mod id)) |
DocPic Picture |
DocMathInline String |
DocMathDisplay String |
DocAName String | A (HTML) anchor. It must not contain any spaces.
DocProperty String |
DocExamples [Example] |
DocHeader (Header (DocH mod id)) |
DocTable (Table (DocH mod id)) |

#### Instances

Instances details

Bifoldable DocH Source # |
Instance details Defined in Documentation.Haddock.Types Methods bifold :: Monoid m => DocH m m -> m Source # bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> DocH a b -> m Source # bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> DocH a b -> c Source # bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> DocH a b -> c Source #
Bifunctor DocH Source # |
Instance details Defined in Documentation.Haddock.Types Methods bimap :: (a -> b) -> (c -> d) -> DocH a c -> DocH b d Source # first :: (a -> b) -> DocH a c -> DocH b c Source # second :: (b -> c) -> DocH a b -> DocH a c Source #
Bitraversable DocH Source # |
Instance details Defined in Documentation.Haddock.Types Methods bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> DocH a b -> f (DocH c d) Source #
Functor (DocH mod) Source # |
Instance details Defined in Documentation.Haddock.Types Methods fmap :: (a -> b) -> DocH mod a -> DocH mod b # (<$) :: a -> DocH mod b -> DocH mod a #
Foldable (DocH mod) Source # |
Instance details Defined in Documentation.Haddock.Types Methods fold :: Monoid m => DocH mod m -> m # foldMap :: Monoid m => (a -> m) -> DocH mod a -> m # foldMap' :: Monoid m => (a -> m) -> DocH mod a -> m # foldr :: (a -> b -> b) -> b -> DocH mod a -> b # foldr' :: (a -> b -> b) -> b -> DocH mod a -> b # foldl :: (b -> a -> b) -> b -> DocH mod a -> b # foldl' :: (b -> a -> b) -> b -> DocH mod a -> b # foldr1 :: (a -> a -> a) -> DocH mod a -> a # foldl1 :: (a -> a -> a) -> DocH mod a -> a # toList :: DocH mod a -> [a] # null :: DocH mod a -> Bool # length :: DocH mod a -> Int # elem :: Eq a => a -> DocH mod a -> Bool # maximum :: Ord a => DocH mod a -> a # minimum :: Ord a => DocH mod a -> a # sum :: Num a => DocH mod a -> a # product :: Num a => DocH mod a -> a #
Traversable (DocH mod) Source # |
Instance details Defined in Documentation.Haddock.Types Methods traverse :: Applicative f => (a -> f b) -> DocH mod a -> f (DocH mod b) # sequenceA :: Applicative f => DocH mod (f a) -> f (DocH mod a) # mapM :: Monad m => (a -> m b) -> DocH mod a -> m (DocH mod b) # sequence :: Monad m => DocH mod (m a) -> m (DocH mod a) #
(NFData a, NFData mod) => NFData (DocH mod a) Source # |
Instance details Defined in Haddock.Types Methods rnf :: DocH mod a -> () Source #
(Binary mod, Binary id) => Binary (DocH mod id) Source # |
Instance details Defined in Haddock.InterfaceFile Methods put_ :: WriteBinHandle -> DocH mod id -> IO () Source # put :: WriteBinHandle -> DocH mod id -> IO (Bin (DocH mod id)) Source # get :: ReadBinHandle -> IO (DocH mod id) Source #
(Eq id, Eq mod) => Eq (DocH mod id) Source # |
Instance details Defined in Documentation.Haddock.Types Methods (==) :: DocH mod id -> DocH mod id -> Bool # (/=) :: DocH mod id -> DocH mod id -> Bool #
(Show id, Show mod) => Show (DocH mod id) Source # |
Instance details Defined in Documentation.Haddock.Types Methods showsPrec :: Int -> DocH mod id -> ShowS # show :: DocH mod id -> String # showList :: [DocH mod id] -> ShowS #

data Example Source #

Constructors

Example |
Fields exampleExpression :: String exampleResult :: [String]

#### Instances

Instances details

NFData Example Source # |
Instance details Defined in Haddock.Types Methods rnf :: Example -> () Source #
Binary Example Source # |
Instance details Defined in Haddock.InterfaceFile Methods put_ :: WriteBinHandle -> Example -> IO () Source # put :: WriteBinHandle -> Example -> IO (Bin Example) Source # get :: ReadBinHandle -> IO Example Source #
Eq Example Source # |
Instance details Defined in Documentation.Haddock.Types Methods (==) :: Example -> Example -> Bool # (/=) :: Example -> Example -> Bool #
Show Example Source # |
Instance details Defined in Documentation.Haddock.Types Methods showsPrec :: Int -> Example -> ShowS # show :: Example -> String # showList :: [Example] -> ShowS #

data Hyperlink id Source #

Constructors

Hyperlink |
Fields hyperlinkUrl :: String hyperlinkLabel :: Maybe id

#### Instances

Instances details

Functor Hyperlink Source # |
Instance details Defined in Documentation.Haddock.Types Methods fmap :: (a -> b) -> Hyperlink a -> Hyperlink b # (<$) :: a -> Hyperlink b -> Hyperlink a #
Foldable Hyperlink Source # |
Instance details Defined in Documentation.Haddock.Types Methods fold :: Monoid m => Hyperlink m -> m # foldMap :: Monoid m => (a -> m) -> Hyperlink a -> m # foldMap' :: Monoid m => (a -> m) -> Hyperlink a -> m # foldr :: (a -> b -> b) -> b -> Hyperlink a -> b # foldr' :: (a -> b -> b) -> b -> Hyperlink a -> b # foldl :: (b -> a -> b) -> b -> Hyperlink a -> b # foldl' :: (b -> a -> b) -> b -> Hyperlink a -> b # foldr1 :: (a -> a -> a) -> Hyperlink a -> a # foldl1 :: (a -> a -> a) -> Hyperlink a -> a # toList :: Hyperlink a -> [a] # null :: Hyperlink a -> Bool # length :: Hyperlink a -> Int # elem :: Eq a => a -> Hyperlink a -> Bool # maximum :: Ord a => Hyperlink a -> a # minimum :: Ord a => Hyperlink a -> a # sum :: Num a => Hyperlink a -> a # product :: Num a => Hyperlink a -> a #
Traversable Hyperlink Source # |
Instance details Defined in Documentation.Haddock.Types Methods traverse :: Applicative f => (a -> f b) -> Hyperlink a -> f (Hyperlink b) # sequenceA :: Applicative f => Hyperlink (f a) -> f (Hyperlink a) # mapM :: Monad m => (a -> m b) -> Hyperlink a -> m (Hyperlink b) # sequence :: Monad m => Hyperlink (m a) -> m (Hyperlink a) #
NFData id => NFData (Hyperlink id) Source # |
Instance details Defined in Haddock.Types Methods rnf :: Hyperlink id -> () Source #
Binary a => Binary (Hyperlink a) Source # |
Instance details Defined in Haddock.InterfaceFile Methods put_ :: WriteBinHandle -> Hyperlink a -> IO () Source # put :: WriteBinHandle -> Hyperlink a -> IO (Bin (Hyperlink a)) Source # get :: ReadBinHandle -> IO (Hyperlink a) Source #
Eq id => Eq (Hyperlink id) Source # |
Instance details Defined in Documentation.Haddock.Types Methods (==) :: Hyperlink id -> Hyperlink id -> Bool # (/=) :: Hyperlink id -> Hyperlink id -> Bool #
Show id => Show (Hyperlink id) Source # |
Instance details Defined in Documentation.Haddock.Types Methods showsPrec :: Int -> Hyperlink id -> ShowS # show :: Hyperlink id -> String # showList :: [Hyperlink id] -> ShowS #

type DocMarkup id a = DocMarkupH (Wrap (ModuleName, OccName)) id a Source #

data DocMarkupH mod id a Source #

`DocMarkupH` is a set of instructions for marking up documentation. In fact, it's really just a mapping from `Doc` to some other type [a], where [a] is usually the type of the output (HTML, say). Use `markup` to apply a `DocMarkupH` to a `DocH`.

Since: haddock-library-1.4.5

Constructors

Markup |
Fields markupEmpty :: a markupString :: String -> a markupParagraph :: a -> a markupAppend :: a -> a -> a markupIdentifier :: id -> a markupIdentifierUnchecked :: mod -> a markupModule :: ModLink a -> a markupWarning :: a -> a markupEmphasis :: a -> a markupBold :: a -> a markupMonospaced :: a -> a markupUnorderedList :: [a] -> a markupOrderedList :: [(Int, a)] -> a markupDefList :: [(a, a)] -> a markupCodeBlock :: a -> a markupHyperlink :: Hyperlink a -> a markupAName :: String -> a markupPic :: Picture -> a markupMathInline :: String -> a markupMathDisplay :: String -> a markupProperty :: String -> a markupExample :: [Example] -> a markupHeader :: Header a -> a markupTable :: Table a -> a

data Documentation name Source #

Constructors

Documentation |
Fields documentationDoc :: Maybe (MDoc name) documentationWarning :: Maybe (Doc name)

#### Instances

Instances details

Functor Documentation Source # |
Instance details Defined in Haddock.Types Methods fmap :: (a -> b) -> Documentation a -> Documentation b # (<$) :: a -> Documentation b -> Documentation a #
NFData name => NFData (Documentation name) Source # |
Instance details Defined in Haddock.Types Methods rnf :: Documentation name -> () Source #

type ArgMap a = Map Name (Map Int (MDoc a)) Source #

type WarningMap = Map Name (Doc Name) Source #

type DocMap a = Map Name (MDoc a) Source #

data HaddockModInfo name Source #

Constructors

HaddockModInfo |
Fields hmi_description :: Maybe (Doc name) hmi_copyright :: Maybe String hmi_license :: Maybe String hmi_maintainer :: Maybe String hmi_stability :: Maybe String hmi_portability :: Maybe String hmi_safety :: Maybe String hmi_language :: Maybe Language hmi_extensions :: [Extension]

#### Instances

Instances details

NFData name => NFData (HaddockModInfo name) Source # |
Instance details Defined in Haddock.Types Methods rnf :: HaddockModInfo name -> () Source #
Binary name => Binary (HaddockModInfo name) Source # |
Instance details Defined in Haddock.InterfaceFile Methods put_ :: WriteBinHandle -> HaddockModInfo name -> IO () Source # put :: WriteBinHandle -> HaddockModInfo name -> IO (Bin (HaddockModInfo name)) Source # get :: ReadBinHandle -> IO (HaddockModInfo name) Source #

markup :: DocMarkupH mod id a -> DocH mod id -> a Source #

# Interface files

data InterfaceFile Source #

Constructors

InterfaceFile |
Fields ifLinkEnv :: LinkEnv ifPackageInfo :: PackageInfo Package meta data. Currently it only consist of a package name, which is not read from the interface file, but inferred from its name. issue # ifInstalledIfaces :: [InstalledInterface]

#### Instances

Instances details

Binary InterfaceFile Source # |
Instance details Defined in Haddock.InterfaceFile Methods put_ :: WriteBinHandle -> InterfaceFile -> IO () Source # put :: WriteBinHandle -> InterfaceFile -> IO (Bin InterfaceFile) Source # get :: ReadBinHandle -> IO InterfaceFile Source #

readInterfaceFile Source #

Arguments

:: NameCache |
-> FilePath |
-> Bool | Disable version check. Can cause runtime crash.
-> IO (Either String InterfaceFile) |

Read a Haddock (`.haddock`) interface file. Return either an `InterfaceFile` or an error message.

This function can be called in two ways. Within a GHC session it will update the use and update the session's name cache. Outside a GHC session a new empty name cache is used.

freshNameCache :: IO NameCache Source #

# Flags and options

data Flag Source #

Constructors

Flag_BuiltInThemes |
Flag_CSS String |
Flag_ReadInterface String |
Flag_DumpInterface String |
Flag_ShowInterface String |
Flag_Heading String |
Flag_Html |
Flag_Hoogle |
Flag_Lib String |
Flag_OutputDir FilePath |
Flag_Prologue FilePath |
Flag_SourceBaseURL String |
Flag_SourceModuleURL String |
Flag_SourceEntityURL String |
Flag_SourceLEntityURL String |
Flag_WikiBaseURL String |
Flag_BaseURL String |
Flag_WikiModuleURL String |
Flag_WikiEntityURL String |
Flag_LaTeX |
Flag_LaTeXStyle String |
Flag_QuickJumpIndex |
Flag_HyperlinkedSource |
Flag_SourceCss String |
Flag_Mathjax String |
Flag_Help |
Flag_Verbosity String |
Flag_Version |
Flag_CompatibleInterfaceVersions |
Flag_InterfaceVersion |
Flag_BypassInterfaceVersonCheck |
Flag_UseContents String |
Flag_GenContents |
Flag_UseIndex String |
Flag_GenIndex |
Flag_IgnoreAllExports |
Flag_HideModule String |
Flag_ShowModule String |
Flag_ShowAllModules |
Flag_ShowExtensions String |
Flag_OptGhc String |
Flag_GhcLibDir String |
Flag_GhcVersion |
Flag_PrintGhcPath |
Flag_PrintGhcLibDir |
Flag_NoWarnings |
Flag_UseUnicode |
Flag_NoTmpCompDir |
Flag_Qualification String |
Flag_PrettyHtml |
Flag_NoPrintMissingDocs |
Flag_PackageName String |
Flag_PackageVersion String |
Flag_Reexport String |
Flag_SinceQualification String |
Flag_IgnoreLinkSymbol String |
Flag_ParCount (Maybe Int) |
Flag_TraceArgs |
Flag_OneShot String |
Flag_NoCompilation |

#### Instances

Instances details

Eq Flag Source # |
Instance details Defined in Haddock.Options Methods (==) :: Flag -> Flag -> Bool # (/=) :: Flag -> Flag -> Bool #
Show Flag Source # |
Instance details Defined in Haddock.Options Methods showsPrec :: Int -> Flag -> ShowS # show :: Flag -> String # showList :: [Flag] -> ShowS #

data DocOption Source #

Source-level options for controlling the documentation.

Constructors

OptHide | This module should not appear in the docs.
OptPrune |
OptIgnoreExports | Pretend everything is exported.
OptNotHome | Not the best place to get docs for things exported by this module.
OptShowExtensions | Render enabled extensions for this module.
OptPrintRuntimeRep | Render runtime reps for this module (see the GHC `-fprint-explicit-runtime-reps` flag)
OptRedactTypeSyns | Hide the RHS of type synonyms in this module that use unexported types.

#### Instances

Instances details

Binary DocOption Source # |
Instance details Defined in Haddock.InterfaceFile Methods put_ :: WriteBinHandle -> DocOption -> IO () Source # put :: WriteBinHandle -> DocOption -> IO (Bin DocOption) Source # get :: ReadBinHandle -> IO DocOption Source #
Eq DocOption Source # |
Instance details Defined in Haddock.Types Methods (==) :: DocOption -> DocOption -> Bool # (/=) :: DocOption -> DocOption -> Bool #
Show DocOption Source # |
Instance details Defined in Haddock.Types Methods showsPrec :: Int -> DocOption -> ShowS # show :: DocOption -> String # showList :: [DocOption] -> ShowS #

# Error handling

data HaddockException Source #

Haddock's own exception type.

Constructors

HaddockException String |
WithContext [String] SomeException |

#### Instances

Instances details

Exception HaddockException Source # |
Instance details Defined in Haddock.Types Methods toException :: HaddockException -> SomeException # fromException :: SomeException -> Maybe HaddockException # displayException :: HaddockException -> String # backtraceDesired :: HaddockException -> Bool #
Show HaddockException Source # |
Instance details Defined in Haddock.Types Methods showsPrec :: Int -> HaddockException -> ShowS # show :: HaddockException -> String # showList :: [HaddockException] -> ShowS #

# Program entry point

haddock :: [String] -> IO () Source #

Run Haddock with given list of arguments.

Haddock's own main function is defined in terms of this:

    main = getArgs >>= haddock

haddockWithGhc :: (forall a. [Flag] -> Ghc a -> IO a) -> [String] -> IO () Source #

getGhcDirs :: [Flag] -> IO (Maybe FilePath, Maybe FilePath) Source #

Find the `lib` directory for GHC and the path to `ghc`

withGhc :: [Flag] -> Ghc a -> IO a Source #