-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A program to find and display the docs and type of a name -- -- Given a module name and a name, or just a name, it will find and -- display the documentation of that name. -- -- EXAMPLE USAGE -- --
-- $ haskell-docs hSetBuffering -- Package: base -- Module: GHC.IO.Handle -- hSetBuffering :: Handle -> BufferMode -> IO () -- Computation hSetBuffering `hdl mode` sets the mode of buffering for -- handle `hdl` on subsequent reads and writes. ---- -- INSTALLATION -- -- You should ensure that you have -- --
-- documentation: True ---- -- in your .cabal/config so that the necessary .haddock files are -- generated. -- -- Haddock is very sensitive to the GHC version. This program tries not -- to be. If you cannot install this package due to a version problem, -- open a Github issue. If the versions match up but the build fails, -- open a Github issue. Neither case should arise. -- -- USING WITH GHCI -- --
-- > :def doc \input -> return (":!haskell-docs " ++ input)
-- > :doc getContents
-- The getContents operation returns all user input as a single string,
-- which is read lazily as it is needed
-- (same as hGetContents stdin).
--
--
-- Add the above :def to your user .ghci to have it on start-up.
--
-- CONTRIBUTION AND ISSUES
--
-- Issues/ideas/contributions please make a Github issue:
-- http://github.com/chrisdone/haskell-docs/issues
@package haskell-docs
@version 4.2.0
-- | All types.
module Haskell.Docs.Types
-- | Identier documentation along with argument docs and identifiers.
data IdentDoc
IdentDoc :: !PackageIdentifier -> !Identifier -> !ModuleName -> !(Doc String) -> !(Maybe Id) -> !(Maybe [(Int, Doc String)]) -> IdentDoc
identDocPackageName :: IdentDoc -> !PackageIdentifier
identDocIdentifier :: IdentDoc -> !Identifier
identDocModuleName :: IdentDoc -> !ModuleName
identDocDocs :: IdentDoc -> !(Doc String)
identDocIdent :: IdentDoc -> !(Maybe Id)
identDocArgDocs :: IdentDoc -> !(Maybe [(Int, Doc String)])
-- | An exception when doing lookups.
data DocsException
NoFindModule :: DocsException
PackageLookupFailed :: !Text -> DocsException
NoModulePackageCombo :: DocsException
NoInterfaceFiles :: DocsException
NoParseInterfaceFiles :: [DocsException] -> DocsException
NoFindNameInExports :: DocsException
NoFindNameInInterface :: DocsException
NoReadInterfaceFile :: String -> DocsException
-- | An identifier.
newtype Identifier
Identifier :: String -> Identifier
unIdentifier :: Identifier -> String
-- | An package name.
newtype PackageName
PackageName :: String -> PackageName
instance Typeable DocsException
instance Show Identifier
instance Eq Identifier
instance Show PackageName
instance Eq PackageName
instance Show DocsException
instance Exception DocsException
instance Eq IdentDoc
-- | Ghc compatibility layer.
module Haskell.Docs.Ghc
-- | Run an action with an initialized GHC package set.
withInitializedPackages :: [String] -> (PackageConfigMap -> Ghc a) -> IO a
-- | Get the type of the given identifier from the given module.
findIdentifier :: ModuleName -> Identifier -> Ghc (Maybe Id)
-- | Make a module name.
makeModuleName :: String -> ModuleName
-- | Run the given GHC action.
run :: Ghc a -> IO a
-- | Pretty print something to string.
showppr :: Outputable a => DynFlags -> a -> String
-- | Wraps showSDocForUser.
showSDocForUser :: DynFlags -> PrintUnqualified -> SDoc -> String
-- | Set the import context.
setImportContext :: ModuleName -> Ghc ()
-- | Show the package name e.g. base.
showPackageName :: PackageIdentifier -> String
-- | Cabal.
module Haskell.Docs.Cabal
-- | Get all installed packages, filtering out the given package.
getAllPackages :: IO [PackageConfig]
-- | Version-portable version of allPackagesByName.
packagesByName :: PackageIndex -> [[InstalledPackageInfo]]
-- | Convert a Cabal module name to a GHC module name.
convModule :: ModuleName -> ModuleName
-- | Because no Functor instance is available.
imap :: (a -> m) -> InstalledPackageInfo_ a -> InstalledPackageInfo_ m
-- | Haddock compatibilty layer and query functions.
module Haskell.Docs.Haddock
-- | Search a name in the given module.
searchIdent :: Maybe PackageConfig -> Identifier -> Ghc (Either DocsException [IdentDoc])
-- | Search a name in the given module.
searchModuleIdent :: Maybe PackageConfig -> ModuleName -> Identifier -> Ghc (Either DocsException [IdentDoc])
-- | Search a name in the given module from the given package.
searchPackageModuleIdent :: Maybe PackageConfig -> PackageName -> ModuleName -> Identifier -> Ghc (Either DocsException [IdentDoc])
filterPrevious :: Maybe (InstalledPackageInfo_ m) -> [InstalledPackageInfo_ m] -> [InstalledPackageInfo_ m]
-- | Search for the identifier in a module in any of the given packages.
searchInPackages :: [PackageConfig] -> Maybe ModuleName -> Identifier -> Ghc (Either a [IdentDoc])
-- | Search for the given identifier in the given package.
searchWithPackage :: PackageConfig -> Maybe ModuleName -> Identifier -> Ghc (Either DocsException [IdentDoc])
-- | Search for the given identifier in the interface.
searchWithInterface :: PackageConfig -> Identifier -> InstalledInterface -> Ghc (Either DocsException [IdentDoc])
-- | Get a mapping from names to doc string of that name from a Haddock
-- interface.
interfaceNameMap :: InstalledInterface -> Map String (Doc String)
-- | Get a mapping from names to doc string of that name from a Haddock
-- interface.
interfaceArgMap :: InstalledInterface -> Map String (Map Int (Doc Name))
-- | Find arguments documentation for the identifier.
lookupArgsDocs :: InstalledInterface -> Identifier -> Ghc (Maybe [(Int, Doc String)])
-- | Search for a module's package, returning suggestions if not found.
-- Filters out the given value.
getPackagesByModule :: ModuleName -> Ghc [PackageConfig]
-- | Get the Haddock interfaces of the given package.
getHaddockInterfacesByPackage :: PackageConfig -> IO [Either DocsException InterfaceFile]
-- | The module symbol doesn't actually exist in the module we intended, so
-- we descend into the module that it does exist in and restart our
-- search process.
descendSearch :: PackageConfig -> Identifier -> Name -> Ghc (Either DocsException [IdentDoc])
-- | Make an index from identifiers to modules.
module Haskell.Docs.Index
-- | Lookup an identifier. Automatically creates an index if none exists.
lookupIdent :: Text -> IO (Maybe (HashMap Text [Text]))
-- | An identifier index.
type Index = HashMap Text Text
-- | Generate an identifier index.
generateIndex :: IO Index
-- | Generate a flat file of all package, module, name combinations.
generateFlatFile :: IO [(String, String, String)]
-- | Save the index to file.
saveIndex :: Index -> IO ()
-- | Filename to read/write index to.
indexFilename :: FilePath
-- | Lookup an entry in the index by identifier.
lookupInIndex :: Text -> IO (Maybe (HashMap Text [Text]))
-- | Extract the "package:Module package:Module" string into a map from
-- package to modules.
extractModules :: ByteString -> HashMap Text [Text]
-- | Formatting of Haddock documentation.
module Haskell.Docs.Formatting
-- | Print docs as s-expressions.
printSexp :: [IdentDoc] -> Ghc ()
-- | Print an identifier' documentation.
printIdentDoc :: Bool -> Bool -> Bool -> IdentDoc -> Ghc ()
-- | Format some documentation to plain text.
formatDoc :: Doc String -> String
-- | S-expression type.
data Sexp
Atom :: String -> Sexp
String :: String -> Sexp
List :: [Sexp] -> Sexp
-- | Render an s-expression to string.
renderSexp :: Sexp -> String
-- | Convert docs to an s-expression.
toSexp :: IdentDoc -> Ghc Sexp
-- | Render the doc.
doc :: Doc String -> String
-- | Strip redundant whitespace.
normalize :: [Char] -> [Char]
-- | Trim either side of a string.
trim :: [Char] -> [Char]
-- | Format an example to plain text.
formatExample :: Example -> String
-- | Format an argument.
formatArg :: Show a => a -> Doc String -> String
-- | Indent after the first line.
indentAfter :: Int -> String -> String
-- | Lookup the documentation of a name in a module (and in a specific
-- package in the case of ambiguity).
module Haskell.Docs
searchAndPrintDoc' :: PackageConfigMap -> Bool -> Bool -> Maybe PackageName -> Maybe ModuleName -> Identifier -> Ghc ()
searchAndPrintDoc :: PackageConfigMap -> Bool -> Bool -> Maybe PackageName -> Maybe ModuleName -> Identifier -> Ghc ()
-- | An identifier.
newtype Identifier
Identifier :: String -> Identifier
unIdentifier :: Identifier -> String
-- | An package name.
newtype PackageName
PackageName :: String -> PackageName