diff options
author | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2013-08-30 06:05:51 +0100 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-01-12 14:48:35 -0600 |
commit | f1f94f2f634fb065f69ca2cc87a4a54f4e3a39ed (patch) | |
tree | c81b6c2b4b6112107670c0a4ac11c644ffb5cf80 /src/Haddock/Interface/Create.hs | |
parent | b11f371fdc9197cb45a6dafbcc0b095273d6614f (diff) |
Per-module extension flags and language listing.
Any extensions that are not enabled by a used language (Haskell2010
&c) will be shown. Furthermore, any implicitly enabled are also going
to be shown. While we could eliminate this either by using the GHC API
or a dirty hack, I opted not to: if a user doesn't want the implied
flags to show, they are recommended to use enable extensions more
carefully or individually. Perhaps this will encourage users to not
enable the most powerful flags needlessly. Enabled with show-extensions.
Conflicts:
src/Haddock/InterfaceFile.hs
Diffstat (limited to 'src/Haddock/Interface/Create.hs')
-rw-r--r-- | src/Haddock/Interface/Create.hs | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs index 825e9624..6c20f00b 100644 --- a/src/Haddock/Interface/Create.hs +++ b/src/Haddock/Interface/Create.hs @@ -3,8 +3,9 @@ ----------------------------------------------------------------------------- -- | -- Module : Haddock.Interface.Create --- Copyright : (c) Simon Marlow 2003-2006, --- David Waern 2006-2009 +-- Copyright : (c) Simon Marlow 2003-2006, +-- David Waern 2006-2009, +-- Mateusz Kowalczyk 2013 -- License : BSD-like -- -- Maintainer : haddock@projects.haskell.org @@ -218,16 +219,20 @@ mkDocOpts mbOpts flags mdl = do [] -> tell ["No option supplied to DOC_OPTION/doc_option"] >> return [] xs -> liftM catMaybes (mapM parseOption xs) Nothing -> return [] - if Flag_HideModule (moduleString mdl) `elem` flags - then return $ OptHide : opts - else return opts + hm <- if Flag_HideModule (moduleString mdl) `elem` flags + then return $ OptHide : opts + else return opts + if Flag_ShowExtensions (moduleString mdl) `elem` flags + then return $ OptShowExtensions : hm + else return hm parseOption :: String -> ErrMsgM (Maybe DocOption) -parseOption "hide" = return (Just OptHide) -parseOption "prune" = return (Just OptPrune) -parseOption "ignore-exports" = return (Just OptIgnoreExports) -parseOption "not-home" = return (Just OptNotHome) +parseOption "hide" = return (Just OptHide) +parseOption "prune" = return (Just OptPrune) +parseOption "ignore-exports" = return (Just OptIgnoreExports) +parseOption "not-home" = return (Just OptNotHome) +parseOption "show-extensions" = return (Just OptShowExtensions) parseOption other = tell ["Unrecognised option: " ++ other] >> return Nothing @@ -649,7 +654,7 @@ lookupDocs n warnings docMap argMap subMap = -- 2) B is visible, but not all its exports are in scope in A, in which case we -- only return those that are. -- 3) B is visible and all its exports are in scope, in which case we return --- a single 'ExportModule' item. +-- a single 'ExportModule' item. moduleExports :: Module -- ^ Module A -> ModuleName -- ^ The real name of B, the exported module -> DynFlags -- ^ The flags used when typechecking A |