aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Interface/Create.hs
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2008-08-03 14:02:51 +0000
committerDavid Waern <david.waern@gmail.com>2008-08-03 14:02:51 +0000
commit286a28681d96c79683a0280e4207362c39669332 (patch)
tree6aa335bbc3a9f9494439b8c8cddf4b978d01a73e /src/Haddock/Interface/Create.hs
parentae0011a4761c0e6d935ecd5781e97b9d19d08782 (diff)
Filter out more declarations
The previous refactorings in H.I.Create introduced a few bugs. Filtering of some types of declarations that we don't handle was removed. This patch fixes this.
Diffstat (limited to 'src/Haddock/Interface/Create.hs')
-rw-r--r--src/Haddock/Interface/Create.hs39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs
index a432ad4a..8944ab7f 100644
--- a/src/Haddock/Interface/Create.hs
+++ b/src/Haddock/Interface/Create.hs
@@ -191,12 +191,9 @@ classDataSubs decl
fields = concat [ fields | RecCon fields <- map con_details cons]
--- All the sub declarations of a class (except default methods), ordered by
+-- All the sub declarations of a class (that we handle), ordered by
-- source location, with documentation attached if it exists.
-classDecls = filter notDef . collectDocs . sortByLoc . declsFromClass
- where
- notDef (L _ (ValD _), _) = False
- notDef _ = True
+classDecls = filterDecls . collectDocs . sortByLoc . declsFromClass
declsFromClass class_ = docs ++ defs ++ sigs ++ ats
@@ -236,15 +233,6 @@ declsFromGroup group =
sigs (ValBindsOut _ x) = x
--- | Filter out declarations that we don't handle in Haddock
-filterDecls :: [DeclWithDoc] -> [DeclWithDoc]
-filterDecls decls = filter (isHandled . unL . fst) decls
- where
- -- TODO: filter out exactly everything we don't handle
- isHandled (ForD (ForeignExport {})) = False
- isHandled _ = True
-
-
-- | Take a field of declarations from a data structure and create HsDecls
-- using the given constructor
decls field con struct = [ L loc (con decl) | L loc decl <- field struct ]
@@ -278,6 +266,29 @@ warnAboutFilteredDecls mod decls = do
--------------------------------------------------------------------------------
+-- Filtering of declarations
+--
+-- We filter out declarations that we don't intend to handle later.
+--------------------------------------------------------------------------------
+
+
+-- | Filter out declarations that we don't handle in Haddock
+filterDecls :: [DeclWithDoc] -> [DeclWithDoc]
+filterDecls decls = filter (isHandled . unL . fst) decls
+ where
+ -- TODO: filter out exactly everything we don't handle
+ isHandled (ForD (ForeignExport {})) = False
+ isHandled (SigD d) = isHandledSig d
+ isHandled (ValD d) = False
+ isHandled _ = True
+
+
+-- | Is the 'Sig' handled by Haddock?
+isHandledSig (TypeSig {}) = True
+isHandledSig _ = False
+
+
+--------------------------------------------------------------------------------
-- Instances
--------------------------------------------------------------------------------