From f1f94f2f634fb065f69ca2cc87a4a54f4e3a39ed Mon Sep 17 00:00:00 2001 From: Mateusz Kowalczyk Date: Fri, 30 Aug 2013 06:05:51 +0100 Subject: 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 --- src/Haddock/InterfaceFile.hs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/Haddock/InterfaceFile.hs') 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 -- cgit v1.2.3