aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Documentation/Haddock.hs
blob: 1aa666cef58b6d18b170be16b0f05097f7aadbad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
-----------------------------------------------------------------------------
-- |
-- Module      :  Documentation.Haddock
-- Copyright   :  (c) David Waern 2010
-- License     :  BSD-like
--
-- Maintainer  :  haddock@projects.haskellorg
-- Stability   :  experimental
-- Portability :  portable
--
-- The Haddock API: A rudimentary, highly experimental API exposing some of
-- the internals of Haddock. Don't expect it to be stable.
-----------------------------------------------------------------------------
module Documentation.Haddock (

  -- * Interface
  Interface(..),
  InstalledInterface(..),
  toInstalledIface,
  createInterfaces,
  processModules,

  -- * Export items & declarations
  ExportItem(..),
  DocForDecl,
  FnArgsDoc,

  -- * Cross-referencing
  LinkEnv,
  DocName(..),

  -- * Instances
  DocInstance,
  InstHead,

  -- * Documentation comments
  Doc,
  MDoc,
  DocH(..),
  Example(..),
  Hyperlink(..),
  DocMarkup,
  DocMarkupH(..),
  Documentation(..),
  ArgMap,
  AliasMap,
  WarningMap,
  DocMap,
  HaddockModInfo(..),
  markup,

  -- * Interface files
  InterfaceFile(..),
  readInterfaceFile,
  freshNameCache,

  -- * Flags and options
  Flag(..),
  DocOption(..),

  -- * Error handling
  HaddockException(..),

  -- * Program entry point
  haddock,
  haddockWithGhc,
  getGhcDirs,
  withGhc
) where

import Documentation.Haddock.Markup (markup)
import Haddock.InterfaceFile
import Haddock.Interface
import Haddock.Types
import Haddock.Options
import Haddock


-- | 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.
createInterfaces
  :: [Flag]         -- ^ A list of command-line flags
  -> [String]       -- ^ File or module names
  -> IO [Interface] -- ^ Resulting list of interfaces
createInterfaces flags modules = do
  (_, ifaces, _) <- withGhc flags (readPackagesAndProcessModules flags modules)
  return ifaces