aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Utils.hs
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2014-11-21 11:23:09 -0600
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2014-12-12 07:22:25 +0000
commit79629515c0fd71baf182a487df94cb5eaa27ab47 (patch)
tree019051026720a9f82ace55f53c2070e916ebc905 /haddock-api/src/Haddock/Utils.hs
parentd3f72165640de939eef36910f89f37f2a9154d31 (diff)
Follow API changes in D426
Signed-off-by: Austin Seipp <aseipp@pobox.com> Conflicts: haddock-api/src/Haddock/Backends/LaTeX.hs haddock-api/src/Haddock/Backends/Xhtml/Decl.hs haddock-api/src/Haddock/Convert.hs
Diffstat (limited to 'haddock-api/src/Haddock/Utils.hs')
-rw-r--r--haddock-api/src/Haddock/Utils.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/haddock-api/src/Haddock/Utils.hs b/haddock-api/src/Haddock/Utils.hs
index c4f8eb97..9a821b2e 100644
--- a/haddock-api/src/Haddock/Utils.hs
+++ b/haddock-api/src/Haddock/Utils.hs
@@ -150,24 +150,23 @@ restrictDataDefn names defn@(HsDataDefn { dd_ND = new_or_data, dd_cons = cons })
restrictCons :: [Name] -> [LConDecl Name] -> [LConDecl Name]
restrictCons names decls = [ L p d | L p (Just d) <- map (fmap keep) decls ]
where
- keep d | unLoc (con_name d) `elem` names =
+ keep d | any (\n -> n `elem` names) (map unLoc $ con_names d) =
case con_details d of
PrefixCon _ -> Just d
RecCon fields
| all field_avail fields -> Just d
- | otherwise -> Just (d { con_details = PrefixCon (field_types fields) })
+ | otherwise -> Just (d { con_details = PrefixCon (field_types (map unL fields)) })
-- if we have *all* the field names available, then
-- keep the record declaration. Otherwise degrade to
-- a constructor declaration. This isn't quite right, but
-- it's the best we can do.
InfixCon _ _ -> Just d
where
- field_avail (ConDeclField n _ _) = unLoc n `elem` names
+ field_avail (L _ (ConDeclField ns _ _)) = all (\n -> unLoc n `elem` names) ns
field_types flds = [ t | ConDeclField _ t _ <- flds ]
keep _ = Nothing
-
restrictDecls :: [Name] -> [LSig Name] -> [LSig Name]
restrictDecls names = mapMaybe (filterLSigNames (`elem` names))