-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A documentation-generation tool for Haskell libraries
--
-- Haddock is a documentation-generation tool for Haskell libraries
@package haddock
@version 2.7.0
-- | Conversion between TyThing and HsDecl. This functionality may be moved
-- into GHC at some point.
module Haddock.Convert
tyThingToLHsDecl :: TyThing -> LHsDecl Name
synifyClassAT :: TyCon -> LTyClDecl Name
synifyTyCon :: TyCon -> TyClDecl Name
synifyDataCon :: Bool -> DataCon -> LConDecl Name
synifyName :: (NamedThing n) => n -> Located Name
synifyIdSig :: SynifyTypeState -> Id -> Sig Name
synifyCtx :: [PredType] -> LHsContext Name
synifyPred :: PredType -> LHsPred Name
synifyTyVars :: [TyVar] -> [LHsTyVarBndr Name]
data SynifyTypeState
-- | normal situation. This is the safe one to use if you don't quite
-- understand what's going on.
WithinType :: SynifyTypeState
-- | beginning of a function definition, in which, to make it look less
-- ugly, those rank-1 foralls are made implicit.
ImplicitizeForAll :: SynifyTypeState
-- | because in class methods the context is added to the type (e.g. adding
-- forall a. Num a => to (+) :: a -> a -> a)
-- which is rather sensible, but we want to restore things to the
-- source-syntax situation where the defining class gets to quantify all
-- its functions for free!
DeleteTopLevelQuantification :: SynifyTypeState
synifyType :: SynifyTypeState -> Type -> LHsType Name
synifyInstHead :: ([TyVar], [PredType], Class, [Type]) -> ([HsPred Name], Name, [HsType Name])
module Haddock.Doc
docAppend :: Doc id -> Doc id -> Doc id
docParagraph :: Doc id -> Doc id
-- | Definition of the command line interface of Haddock
module Haddock.Options
parseHaddockOpts :: [String] -> IO ([Flag], [String])
data Flag
Flag_CSS :: String -> Flag
Flag_Debug :: Flag
Flag_ReadInterface :: String -> Flag
Flag_DumpInterface :: String -> Flag
Flag_Heading :: String -> Flag
Flag_Html :: Flag
Flag_Hoogle :: Flag
Flag_HtmlHelp :: String -> Flag
Flag_Lib :: String -> Flag
Flag_OutputDir :: FilePath -> Flag
Flag_Prologue :: FilePath -> Flag
Flag_SourceBaseURL :: String -> Flag
Flag_SourceModuleURL :: String -> Flag
Flag_SourceEntityURL :: String -> Flag
Flag_WikiBaseURL :: String -> Flag
Flag_WikiModuleURL :: String -> Flag
Flag_WikiEntityURL :: String -> Flag
Flag_Help :: Flag
Flag_Verbosity :: String -> Flag
Flag_Version :: Flag
Flag_UseContents :: String -> Flag
Flag_GenContents :: Flag
Flag_UseIndex :: String -> Flag
Flag_GenIndex :: Flag
Flag_IgnoreAllExports :: Flag
Flag_HideModule :: String -> Flag
Flag_OptGhc :: String -> Flag
Flag_GhcLibDir :: String -> Flag
Flag_GhcVersion :: Flag
Flag_PrintGhcLibDir :: Flag
Flag_NoWarnings :: Flag
Flag_UseUnicode :: Flag
getUsage :: IO String
ghcFlags :: [Flag] -> [String]
ifacePairs :: [Flag] -> [(FilePath, FilePath)]
instance Eq Flag
module Haddock.Interface.AttachInstances
attachInstances :: [Interface] -> InstIfaceMap -> Ghc [Interface]
instance Eq SimpleType
instance Ord SimpleType
module Haddock.Interface.Rename
renameInterface :: LinkEnv -> Bool -> Interface -> ErrMsgM Interface
instance Monad (GenRnM n)
module Haddock.Interface.ExtractFnArgDocs
getDeclFnArgDocs :: HsDecl Name -> Map Int HsDocString
getSigFnArgDocs :: Sig Name -> Map Int HsDocString
getTypeFnArgDocs :: LHsType Name -> Map Int HsDocString
module Haddock.Interface.Rn
rnDoc :: GlobalRdrEnv -> Doc RdrName -> Doc Name
rnHaddockModInfo :: GlobalRdrEnv -> HaddockModInfo RdrName -> HaddockModInfo Name
instance Monad Id
module Haddock.Interface.ParseModuleHeader
parseModuleHeader :: String -> Either String (HaddockModInfo RdrName, Doc RdrName)
module Haddock.Interface.LexParseRn
data HaddockCommentType
NormalHaddockComment :: HaddockCommentType
DocSectionComment :: HaddockCommentType
lexParseRnHaddockComment :: HaddockCommentType -> GlobalRdrEnv -> HsDocString -> ErrMsgM (Maybe (Doc Name))
lexParseRnHaddockCommentList :: HaddockCommentType -> GlobalRdrEnv -> [HsDocString] -> ErrMsgM (Maybe (Doc Name))
lexParseRnMbHaddockComment :: HaddockCommentType -> GlobalRdrEnv -> Maybe HsDocString -> ErrMsgM (Maybe (Doc Name))
lexParseRnHaddockModHeader :: GlobalRdrEnv -> GhcDocHdr -> ErrMsgM (HaddockModInfo Name, Maybe (Doc Name))
module Haddock.Interface.Create
-- | Process the data in the GhcModule to produce an interface. To do this,
-- we need access to already processed modules in the topological sort.
-- That's what's in the module map.
createInterface :: GhcModule -> [Flag] -> ModuleMap -> InstIfaceMap -> ErrMsgGhc Interface
-- | Here we build the actual module interfaces. By interface we mean the
-- information that is used to render a Haddock page for a module. Parts
-- of this information are also stored in the .haddock files.
module Haddock.Interface
-- | Create Interface structures by typechecking the list of modules
-- using the GHC API and processing the resulting syntax trees.
createInterfaces :: Verbosity -> [String] -> [Flag] -> [InterfaceFile] -> Ghc ([Interface], LinkEnv)
-- | The Haddock API: A rudimentory, highly experimental API exposing some
-- of the internals of Haddock. Don't expect it to be stable.
module Documentation.Haddock
-- | The data structure used to render a Haddock page for a module - it is
-- the interface of the module. The core of Haddock lies in creating this
-- structure (see Haddock.Interface). The structure also holds
-- intermediate data needed during its creation.
data Interface
Interface :: Module -> FilePath -> !HaddockModInfo Name -> !Maybe (Doc Name) -> Maybe (Doc DocName) -> ![DocOption] -> Map Name DeclInfo -> Map Name (DocForDecl DocName) -> Map Name [Name] -> ![ExportItem Name] -> [ExportItem DocName] -> ![Name] -> ![Name] -> ![Instance] -> Map Name (Doc Name) -> Interface
-- | The module represented by this interface.
ifaceMod :: Interface -> Module
-- | Original file name of the module.
ifaceOrigFilename :: Interface -> FilePath
-- | Textual information about the module.
ifaceInfo :: Interface -> !HaddockModInfo Name
-- | Documentation header.
ifaceDoc :: Interface -> !Maybe (Doc Name)
-- | Documentation header with link information.
ifaceRnDoc :: Interface -> Maybe (Doc DocName)
-- | Haddock options for this module (prune, ignore-exports, etc).
ifaceOptions :: Interface -> ![DocOption]
-- | Declarations originating from the module. Excludes declarations
-- without names (instances and stand-alone documentation comments).
-- Includes names of subordinate declarations mapped to their parent
-- declarations.
ifaceDeclMap :: Interface -> Map Name DeclInfo
-- | Documentation of declarations originating from the module (including
-- subordinates).
ifaceRnDocMap :: Interface -> Map Name (DocForDecl DocName)
ifaceSubMap :: Interface -> Map Name [Name]
ifaceExportItems :: Interface -> ![ExportItem Name]
ifaceRnExportItems :: Interface -> [ExportItem DocName]
-- | All names exported by the module.
ifaceExports :: Interface -> ![Name]
-- | All "visible" names exported by the module. A visible name is a name
-- that will show up in the documentation of the module.
ifaceVisibleExports :: Interface -> ![Name]
-- | Instances exported by the module.
ifaceInstances :: Interface -> ![Instance]
-- | Documentation of instances defined in the module.
ifaceInstanceDocMap :: Interface -> Map Name (Doc Name)
-- | A smaller version of Interface that can be created from
-- Haddock's interface files (InterfaceFile).
data InstalledInterface
InstalledInterface :: Module -> HaddockModInfo Name -> Map Name (DocForDecl Name) -> [Name] -> [Name] -> [DocOption] -> Map Name [Name] -> InstalledInterface
-- | The module represented by this interface.
instMod :: InstalledInterface -> Module
-- | Textual information about the module.
instInfo :: InstalledInterface -> HaddockModInfo Name
-- | Documentation of declarations originating from the module (including
-- subordinates).
instDocMap :: InstalledInterface -> Map Name (DocForDecl Name)
-- | All names exported by this module.
instExports :: InstalledInterface -> [Name]
-- | All "visible" names exported by the module. A visible name is a name
-- that will show up in the documentation of the module.
instVisibleExports :: InstalledInterface -> [Name]
-- | Haddock options for this module (prune, ignore-exports, etc).
instOptions :: InstalledInterface -> [DocOption]
instSubMap :: InstalledInterface -> Map Name [Name]
-- | Create Interface structures by typechecking the list of modules
-- using the GHC API and processing the resulting syntax trees.
createInterfaces :: Verbosity -> [String] -> [Flag] -> [InterfaceFile] -> Ghc ([Interface], LinkEnv)
data ExportItem name
-- | An exported declaration
ExportDecl :: LHsDecl name -> DocForDecl name -> [(name, DocForDecl name)] -> [DocInstance name] -> ExportItem name
-- | A declaration
expItemDecl :: ExportItem name -> LHsDecl name
-- | Maybe a doc comment, and possibly docs for arguments (if this decl is
-- a function or type-synonym)
expItemMbDoc :: ExportItem name -> DocForDecl name
-- | Subordinate names, possibly with documentation
expItemSubDocs :: ExportItem name -> [(name, DocForDecl name)]
-- | Instances relevant to this declaration, possibly with documentation
expItemInstances :: ExportItem name -> [DocInstance name]
-- | An exported entity for which we have no documentation (perhaps because
-- it resides in another package)
ExportNoDecl :: name -> [name] -> ExportItem name
expItemName :: ExportItem name -> name
-- | Subordinate names
expItemSubs :: ExportItem name -> [name]
-- | A section heading
ExportGroup :: Int -> String -> Doc name -> ExportItem name
-- | Section level (1, 2, 3, ... )
expItemSectionLevel :: ExportItem name -> Int
-- | Section id (for hyperlinks)
expItemSectionId :: ExportItem name -> String
-- | Section heading text
expItemSectionText :: ExportItem name -> Doc name
-- | Some documentation
ExportDoc :: (Doc name) -> ExportItem name
-- | A cross-reference to another module
ExportModule :: Module -> ExportItem name
-- | A declaration that may have documentation, including its subordinates,
-- which may also have documentation
type DeclInfo = (Decl, DocForDecl Name, [(Name, DocForDecl Name)])
type DocForDecl name = (Maybe (Doc name), FnArgsDoc name)
-- | Arguments and result are indexed by Int, zero-based from the left,
-- because that's the easiest to use when recursing over types.
type FnArgsDoc name = Map Int (Doc name)
-- | An environment used to create hyper-linked syntax.
type LinkEnv = Map Name Module
-- | An extension of Name that may contain the preferred place to
-- link to in the documentation.
data DocName
Documented :: Name -> Module -> DocName
Undocumented :: Name -> DocName
-- | The OccName of this name.
docNameOcc :: DocName -> OccName
-- | An instance head that may have documentation.
type DocInstance name = (InstHead name, Maybe (Doc name))
-- | The head of an instance. Consists of a context, a class name and a
-- list of instance types.
type InstHead name = ([HsPred name], name, [HsType name])
data Doc id
DocEmpty :: Doc id
DocAppend :: (Doc id) -> (Doc id) -> Doc id
DocString :: String -> Doc id
DocParagraph :: (Doc id) -> Doc id
DocIdentifier :: [id] -> Doc id
DocModule :: String -> Doc id
DocEmphasis :: (Doc id) -> Doc id
DocMonospaced :: (Doc id) -> Doc id
DocUnorderedList :: [Doc id] -> Doc id
DocOrderedList :: [Doc id] -> Doc id
DocDefList :: [(Doc id, Doc id)] -> Doc id
DocCodeBlock :: (Doc id) -> Doc id
DocURL :: String -> Doc id
DocPic :: String -> Doc id
DocAName :: String -> Doc id
data DocMarkup id a
Markup :: a -> (String -> a) -> (a -> a) -> (a -> a -> a) -> ([id] -> a) -> (String -> a) -> (a -> a) -> (a -> a) -> ([a] -> a) -> ([a] -> a) -> ([(a, a)] -> a) -> (a -> a) -> (String -> a) -> (String -> a) -> (String -> a) -> DocMarkup id a
markupEmpty :: DocMarkup id a -> a
markupString :: DocMarkup id a -> String -> a
markupParagraph :: DocMarkup id a -> a -> a
markupAppend :: DocMarkup id a -> a -> a -> a
markupIdentifier :: DocMarkup id a -> [id] -> a
markupModule :: DocMarkup id a -> String -> a
markupEmphasis :: DocMarkup id a -> a -> a
markupMonospaced :: DocMarkup id a -> a -> a
markupUnorderedList :: DocMarkup id a -> [a] -> a
markupOrderedList :: DocMarkup id a -> [a] -> a
markupDefList :: DocMarkup id a -> [(a, a)] -> a
markupCodeBlock :: DocMarkup id a -> a -> a
markupURL :: DocMarkup id a -> String -> a
markupAName :: DocMarkup id a -> String -> a
markupPic :: DocMarkup id a -> String -> a
data HaddockModInfo name
HaddockModInfo :: Maybe (Doc name) -> Maybe String -> Maybe String -> Maybe String -> HaddockModInfo name
hmi_description :: HaddockModInfo name -> Maybe (Doc name)
hmi_portability :: HaddockModInfo name -> Maybe String
hmi_stability :: HaddockModInfo name -> Maybe String
hmi_maintainer :: HaddockModInfo name -> Maybe String
data InterfaceFile
InterfaceFile :: LinkEnv -> [InstalledInterface] -> InterfaceFile
ifLinkEnv :: InterfaceFile -> LinkEnv
ifInstalledIfaces :: InterfaceFile -> [InstalledInterface]
-- | 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. The function is therefore
-- generic in the monad being used. The exact monad is whichever monad
-- the first argument, the getter and setter of the name cache, requires.
readInterfaceFile :: (MonadIO m) => NameCacheAccessor m -> FilePath -> m (Either String InterfaceFile)
nameCacheFromGhc :: NameCacheAccessor Ghc
freshNameCache :: NameCacheAccessor IO
type NameCacheAccessor m = (m NameCache, NameCache -> m ())
data Flag
Flag_CSS :: String -> Flag
Flag_Debug :: Flag
Flag_ReadInterface :: String -> Flag
Flag_DumpInterface :: String -> Flag
Flag_Heading :: String -> Flag
Flag_Html :: Flag
Flag_Hoogle :: Flag
Flag_HtmlHelp :: String -> Flag
Flag_Lib :: String -> Flag
Flag_OutputDir :: FilePath -> Flag
Flag_Prologue :: FilePath -> Flag
Flag_SourceBaseURL :: String -> Flag
Flag_SourceModuleURL :: String -> Flag
Flag_SourceEntityURL :: String -> Flag
Flag_WikiBaseURL :: String -> Flag
Flag_WikiModuleURL :: String -> Flag
Flag_WikiEntityURL :: String -> Flag
Flag_Help :: Flag
Flag_Verbosity :: String -> Flag
Flag_Version :: Flag
Flag_UseContents :: String -> Flag
Flag_GenContents :: Flag
Flag_UseIndex :: String -> Flag
Flag_GenIndex :: Flag
Flag_IgnoreAllExports :: Flag
Flag_HideModule :: String -> Flag
Flag_OptGhc :: String -> Flag
Flag_GhcLibDir :: String -> Flag
Flag_GhcVersion :: Flag
Flag_PrintGhcLibDir :: Flag
Flag_NoWarnings :: Flag
Flag_UseUnicode :: Flag
-- | Source-level options for controlling the documentation.
data DocOption
-- | This module should not appear in the docs
OptHide :: DocOption
OptPrune :: DocOption
-- | Pretend everything is exported
OptIgnoreExports :: DocOption
-- | Not the best place to get docs for things exported by this module.
OptNotHome :: DocOption