summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Flags.hs
diff options
context:
space:
mode:
authorZubin Duggal <zubin@cmi.ac.in>2022-03-12 00:07:56 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-23 13:39:39 -0400
commitb91798be48d9fa02610b419ccea15a7dfd663823 (patch)
treefb87654ccd4a1e92e8c7a15bf454a867460869a3 /compiler/GHC/Driver/Flags.hs
parent52ffd38c610f418ee1d1a549cfdfdaa11794ea40 (diff)
downloadhaskell-b91798be48d9fa02610b419ccea15a7dfd663823.tar.gz
hi haddock: Lex and store haddock docs in interface files
Names appearing in Haddock docstrings are lexed and renamed like any other names appearing in the AST. We currently rename names irrespective of the namespace, so both type and constructor names corresponding to an identifier will appear in the docstring. Haddock will select a given name as the link destination based on its own heuristics. This patch also restricts the limitation of `-haddock` being incompatible with `Opt_KeepRawTokenStream`. The export and documenation structure is now computed in GHC and serialised in .hi files. This can be used by haddock to directly generate doc pages without reparsing or renaming the source. At the moment the operation of haddock is not modified, that's left to a future patch. Updates the haddock submodule with the minimum changes needed.
Diffstat (limited to 'compiler/GHC/Driver/Flags.hs')
-rw-r--r--compiler/GHC/Driver/Flags.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/GHC/Driver/Flags.hs b/compiler/GHC/Driver/Flags.hs
index 1d1222fbab..a2ac1b75f4 100644
--- a/compiler/GHC/Driver/Flags.hs
+++ b/compiler/GHC/Driver/Flags.hs
@@ -21,19 +21,23 @@ where
import GHC.Prelude
import GHC.Utils.Outputable
+import GHC.Utils.Binary
import GHC.Data.EnumSet as EnumSet
import Control.Monad (guard)
import Data.List.NonEmpty (NonEmpty(..))
import Data.Maybe (fromMaybe,mapMaybe)
-
data Language = Haskell98 | Haskell2010 | GHC2021
deriving (Eq, Enum, Show, Bounded)
instance Outputable Language where
ppr = text . show
+instance Binary Language where
+ put_ bh = put_ bh . fromEnum
+ get bh = toEnum <$> get bh
+
-- | Debugging flags
data DumpFlag
-- See Note [Updating flag description in the User's Guide]