diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Distribution/Haddock.hs | 5 | ||||
-rw-r--r-- | src/Haddock/Backends/Html.hs | 1 | ||||
-rw-r--r-- | src/Haddock/DocName.hs | 51 | ||||
-rw-r--r-- | src/Haddock/Interface.hs | 1 | ||||
-rw-r--r-- | src/Haddock/Interface/Rename.hs | 1 | ||||
-rw-r--r-- | src/Haddock/InterfaceFile.hs | 24 | ||||
-rw-r--r-- | src/Haddock/Types.hs | 15 |
7 files changed, 40 insertions, 58 deletions
diff --git a/src/Distribution/Haddock.hs b/src/Distribution/Haddock.hs index 06931d08..8057ef4b 100644 --- a/src/Distribution/Haddock.hs +++ b/src/Distribution/Haddock.hs @@ -13,10 +13,11 @@ module Distribution.Haddock ( InterfaceFile(..), LinkEnv, InstalledInterface(..), - module Haddock.DocName + DocName(..), + docNameOcc ) where import Haddock.InterfaceFile import Haddock.Types -import Haddock.DocName + diff --git a/src/Haddock/Backends/Html.hs b/src/Haddock/Backends/Html.hs index 34b367de..0ebac139 100644 --- a/src/Haddock/Backends/Html.hs +++ b/src/Haddock/Backends/Html.hs @@ -14,7 +14,6 @@ module Haddock.Backends.Html ( import Prelude hiding (div) -import Haddock.DocName import Haddock.Backends.DevHelp import Haddock.Backends.HH import Haddock.Backends.HH2 diff --git a/src/Haddock/DocName.hs b/src/Haddock/DocName.hs deleted file mode 100644 index 227d63e8..00000000 --- a/src/Haddock/DocName.hs +++ /dev/null @@ -1,51 +0,0 @@ -{-# OPTIONS_HADDOCK hide #-} - --- --- Haddock - A Haskell Documentation Tool --- --- (c) Simon Marlow 2003 --- - - -module Haddock.DocName where - - -import GHC -import Name -import Binary - - -data DocName = Documented Name Module | Undocumented Name - deriving Eq - - --- | The 'OccName' belonging to this name -docNameOcc :: DocName -> OccName -docNameOcc = nameOccName . getName - - -instance NamedThing DocName where - getName (Documented name _) = name - getName (Undocumented name) = name - - -instance Binary DocName where - put_ bh (Documented name modu) = do - putByte bh 0 - put_ bh name - put_ bh modu - put_ bh (Undocumented name) = do - putByte bh 1 - put_ bh name - - get bh = do - h <- getByte bh - case h of - 0 -> do - name <- get bh - modu <- get bh - return (Documented name modu) - 1 -> do - name <- get bh - return (Undocumented name) - _ -> error "get DocName: Bad h" diff --git a/src/Haddock/Interface.hs b/src/Haddock/Interface.hs index b3b2395b..529cd565 100644 --- a/src/Haddock/Interface.hs +++ b/src/Haddock/Interface.hs @@ -14,7 +14,6 @@ module Haddock.Interface ( ) where -import Haddock.DocName import Haddock.Interface.Create import Haddock.Interface.AttachInstances import Haddock.Interface.Rename diff --git a/src/Haddock/Interface/Rename.hs b/src/Haddock/Interface/Rename.hs index 05bb2ccf..6d806806 100644 --- a/src/Haddock/Interface/Rename.hs +++ b/src/Haddock/Interface/Rename.hs @@ -8,7 +8,6 @@ module Haddock.Interface.Rename (renameInterface) where -import Haddock.DocName import Haddock.Types import Haddock.GHC.Utils diff --git a/src/Haddock/InterfaceFile.hs b/src/Haddock/InterfaceFile.hs index 7ed200ca..8a1a909c 100644 --- a/src/Haddock/InterfaceFile.hs +++ b/src/Haddock/InterfaceFile.hs @@ -14,7 +14,6 @@ module Haddock.InterfaceFile ( ) where -import Haddock.DocName () import Haddock.Types import Haddock.Utils @@ -515,3 +514,26 @@ instance Binary name => Binary (HaddockModInfo name) where stabi <- get bh maint <- get bh return (HaddockModInfo descr porta stabi maint) + + +instance Binary DocName where + put_ bh (Documented name modu) = do + putByte bh 0 + put_ bh name + put_ bh modu + put_ bh (Undocumented name) = do + putByte bh 1 + put_ bh name + + get bh = do + h <- getByte bh + case h of + 0 -> do + name <- get bh + modu <- get bh + return (Documented name modu) + 1 -> do + name <- get bh + return (Undocumented name) + _ -> error "get DocName: Bad h" + diff --git a/src/Haddock/Types.hs b/src/Haddock/Types.hs index b47444b7..d20d3358 100644 --- a/src/Haddock/Types.hs +++ b/src/Haddock/Types.hs @@ -10,7 +10,6 @@ module Haddock.Types where -import Haddock.DocName import Data.Map (Map) import qualified Data.Map as Map import GHC hiding (NoLink) @@ -27,6 +26,20 @@ type Doc = HsDoc Name type DeclInfo = (Decl, Maybe Doc, [(Name, Maybe Doc)]) +data DocName = Documented Name Module | Undocumented Name + deriving Eq + + +-- | The 'OccName' belonging to this name +docNameOcc :: DocName -> OccName +docNameOcc = nameOccName . getName + + +instance NamedThing DocName where + getName (Documented name _) = name + getName (Undocumented name) = name + + {-! for DocOption derive: Binary !-} data DocOption = OptHide -- ^ This module should not appear in the docs |