aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Types.hs
diff options
context:
space:
mode:
authorSimon Hengel <sol@typeful.net>2012-05-16 17:14:21 +0200
committerSimon Hengel <sol@typeful.net>2012-05-17 19:08:20 +0200
commite090bbc5bdc8eb34d5340e467c7157341dfdd945 (patch)
tree5d0742e54dd4c85672cb903f0db0db56449e3f47 /src/Haddock/Types.hs
parent986ff3c5b2e4e519171816c3ad6caa81d4808919 (diff)
newtype-wrap Doc nodes for things that may have warnings attached
Diffstat (limited to 'src/Haddock/Types.hs')
-rw-r--r--src/Haddock/Types.hs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Haddock/Types.hs b/src/Haddock/Types.hs
index 97d56a52..f8d51b2b 100644
--- a/src/Haddock/Types.hs
+++ b/src/Haddock/Types.hs
@@ -67,10 +67,10 @@ data Interface = Interface
, ifaceInfo :: !(HaddockModInfo Name)
-- | Documentation header.
- , ifaceDoc :: !(Maybe (Doc Name))
+ , ifaceDoc :: !(Documentation Name)
-- | Documentation header with cross-reference information.
- , ifaceRnDoc :: Maybe (Doc DocName)
+ , ifaceRnDoc :: Documentation DocName
-- | Haddock options for this module (prune, ignore-exports, etc).
, ifaceOptions :: ![DocOption]
@@ -214,19 +214,23 @@ data ExportItem name
| ExportModule Module
+newtype Documentation name = Documentation (Maybe (Doc name))
+ deriving Functor
+
+
-- | Arguments and result are indexed by Int, zero-based from the left,
-- because that's the easiest to use when recursing over types.
type FnArgsDoc name = Map Int (Doc name)
-type DocForDecl name = (Maybe (Doc name), FnArgsDoc name)
+type DocForDecl name = (Documentation name, FnArgsDoc name)
noDocForDecl :: DocForDecl name
-noDocForDecl = (Nothing, Map.empty)
+noDocForDecl = (Documentation Nothing, Map.empty)
unrenameDocForDecl :: DocForDecl DocName -> DocForDecl Name
-unrenameDocForDecl (mbDoc, fnArgsDoc) =
- (fmap unrenameDoc mbDoc, fmap unrenameDoc fnArgsDoc)
+unrenameDocForDecl (doc, fnArgsDoc) =
+ (fmap getName doc, (fmap . fmap) getName fnArgsDoc)
-----------------------------------------------------------------------------
@@ -304,10 +308,6 @@ instance Monoid (Doc id) where
mappend = DocAppend
-unrenameDoc :: Doc DocName -> Doc Name
-unrenameDoc = fmap getName
-
-
data Example = Example
{ exampleExpression :: String
, exampleResult :: [String]