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/InterfaceFile.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/InterfaceFile.hs')
-rw-r--r-- | src/Haddock/InterfaceFile.hs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/Haddock/InterfaceFile.hs b/src/Haddock/InterfaceFile.hs index 6bf22c9b..81ff17fd 100644 --- a/src/Haddock/InterfaceFile.hs +++ b/src/Haddock/InterfaceFile.hs @@ -3,7 +3,8 @@ ----------------------------------------------------------------------------- -- | -- Module : Haddock.InterfaceFile --- Copyright : (c) David Waern 2006-2009 +-- Copyright : (c) David Waern 2006-2009, +-- Mateusz Kowalczyk 2013 -- License : BSD-like -- -- Maintainer : haddock@projects.haskell.org @@ -24,6 +25,7 @@ import Haddock.Utils hiding (out) import Control.Monad import Data.Array +import Data.Functor ((<$>)) import Data.IORef import Data.List import qualified Data.Map as Map @@ -396,6 +398,8 @@ instance Binary DocOption where putByte bh 2 put_ bh OptNotHome = do putByte bh 3 + put_ bh OptShowExtensions = do + putByte bh 4 get bh = do h <- getByte bh case h of @@ -407,6 +411,8 @@ instance Binary DocOption where return OptIgnoreExports 3 -> do return OptNotHome + 4 -> do + return OptShowExtensions _ -> fail "invalid binary data found" @@ -590,6 +596,8 @@ instance Binary name => Binary (HaddockModInfo name) where put_ bh (hmi_stability hmi) put_ bh (hmi_portability hmi) put_ bh (hmi_safety hmi) + put_ bh (fromEnum <$> hmi_language hmi) + put_ bh (map fromEnum $ hmi_extensions hmi) get bh = do descr <- get bh @@ -599,8 +607,9 @@ instance Binary name => Binary (HaddockModInfo name) where stabi <- get bh porta <- get bh safet <- get bh - return (HaddockModInfo descr copyr licen maint stabi porta safet) - + langu <- fmap toEnum <$> get bh + exten <- map toEnum <$> get bh + return (HaddockModInfo descr copyr licen maint stabi porta safet langu exten) instance Binary DocName where put_ bh (Documented name modu) = do |