aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2008-10-22 20:11:46 +0000
committerDavid Waern <david.waern@gmail.com>2008-10-22 20:11:46 +0000
commit6e486b769f104281b4c56689c31ed522c800fcca (patch)
tree651a6c476f79783ccba0c42f6adcc675dd82515c /src
parent5b59c1cfad9fce7613639659adb37f517cef7cc1 (diff)
Tidy up code in H.I.Create a little
Remove commented out half-done type instance support, and remove DeclWithDoc synonym.
Diffstat (limited to 'src')
-rw-r--r--src/Haddock/Interface/Create.hs41
1 files changed, 3 insertions, 38 deletions
diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs
index 41953353..25f04d31 100644
--- a/src/Haddock/Interface/Create.hs
+++ b/src/Haddock/Interface/Create.hs
@@ -56,7 +56,6 @@ createInterface ghcMod flags modMap = do
decls0 = declInfos . topDecls $ group
decls = filterOutInstances decls0
declMap = mkDeclMap decls
--- famMap = mkFamMap decls'
ignoreExps = Flag_IgnoreAllExports `elem` flags
exportedNames = ghcExportedNames ghcMod
instances = ghcInstances ghcMod
@@ -127,14 +126,6 @@ parseOption other = tell ["Unrecognised option: " ++ other] >> return Nothing
--------------------------------------------------------------------------------
-type DeclWithDoc = (Decl, Maybe Doc)
-
-
--- A list of type or data instance declarations with an optional family
--- declaration.
--- type Family = (Maybe DeclWithDoc, [DeclWithDoc])
-
-
-- Make a map from names to 'DeclInfo's. Exclude declarations that don't
-- have names (instances and stand-alone documentation comments). Include
-- subordinate names, but map them to their parent declarations.
@@ -151,19 +142,6 @@ declInfos decls = [ (parent, doc, subordinates d)
| (parent@(L _ d), doc) <- decls]
--- | Group type family instances together. Include the family declaration
--- if found.
-{-mkFamMap :: [DeclWithDoc] -> Map Name Family
-mkFamMap decls =
- Map.fromList [ (tcdName $ ex $ head $ g, family g) | g <- groups ]
- where
- family g = first listToMaybe $ partition (isFamilyDecl . ex) g
- groups = groupBy (comparing (tcdName . ex)) $
- filter (isTyClD . unLoc . fst) decls
- ex ((L _ (TyClD d)), _) = d
--}
-
-
subordinates (TyClD d) = classDataSubs d
subordinates _ = []
@@ -205,7 +183,7 @@ declName (SigD sig) = fromJust $ sigNameNoLoc sig
-- | The top-level declarations of a module that we care about,
-- ordered by source location, with documentation attached if it exists.
-topDecls :: HsGroup Name -> [DeclWithDoc]
+topDecls :: HsGroup Name -> [(Decl, Maybe Doc)]
topDecls = filterClasses . filterDecls . collectDocs . sortByLoc . declsFromGroup
@@ -266,7 +244,7 @@ warnAboutFilteredDecls mod decls = do
-- | Filter out declarations that we don't handle in Haddock
-filterDecls :: [DeclWithDoc] -> [DeclWithDoc]
+filterDecls :: [(Decl, Maybe Doc)] -> [(Decl, Maybe Doc)]
filterDecls decls = filter (isHandled . unL . fst) decls
where
isHandled (ForD (ForeignImport {})) = True
@@ -279,7 +257,7 @@ filterDecls decls = filter (isHandled . unL . fst) decls
-- | Go through all class declarations and filter their sub-declarations
-filterClasses :: [DeclWithDoc] -> [DeclWithDoc]
+filterClasses :: [(Decl, Maybe Doc)] -> [(Decl, Maybe Doc)]
filterClasses decls = [ if isClassD d then (L loc (filterClass d), doc) else x
| x@(L loc d, doc) <- decls ]
where
@@ -288,19 +266,6 @@ filterClasses decls = [ if isClassD d then (L loc (filterClass d), doc) else x
--------------------------------------------------------------------------------
--- Instances
---------------------------------------------------------------------------------
-
-{-
-matchingInsts :: Name -> [Instances] -> [Instances]
-matchingInsts name instances = filter ((==) name . is_cls) instances
-
-
-instToData :: Instance -> LHsDecl Name
-instToData inst = TyData {
--}
-
---------------------------------------------------------------------------------
-- Collect docs
--
-- To be able to attach the right Haddock comment to the right declaration,