aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2014-03-11 08:42:34 +0100
committerNiklas Haas <git@nand.wakku.to>2014-03-11 10:26:05 +0100
commitb8efaf4ead90c5c95367cc479da522b820b5004e (patch)
tree3b02d506f2d5d2adbac695dcaa8ed235454cbd31 /src
parent72f655f5a4429403674521d251e6cccf62d76747 (diff)
Filter family instances of hidden types
Currently, this check does not extend to hidden right hand sides, although it probably should hide them in that case.
Diffstat (limited to 'src')
-rw-r--r--src/Haddock/Interface/AttachInstances.hs15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/Haddock/Interface/AttachInstances.hs b/src/Haddock/Interface/AttachInstances.hs
index 88512c1a..60ae4661 100644
--- a/src/Haddock/Interface/AttachInstances.hs
+++ b/src/Haddock/Interface/AttachInstances.hs
@@ -73,6 +73,10 @@ attachToExportItem expInfo iface ifaceMap instIfaceMap export =
let fam_insts = [ (synifyFamInst i, n)
| i <- sortBy (comparing instFam) fam_instances
, let n = instLookup instDocMap (getName i) iface ifaceMap instIfaceMap
+ , not $ isNameHidden expInfo (fi_fam i)
+ , not $ any (isTypeHidden expInfo) (fi_tys i)
+ -- Should we check for hidden RHS as well?
+ -- Ideally, in that case the RHS should simply not show up
]
cls_insts = [ (synifyInstHead i, instLookup instDocMap n iface ifaceMap instIfaceMap)
| let is = [ (instanceHead' i, getName i) | i <- cls_instances ]
@@ -199,11 +203,11 @@ isInstanceHidden expInfo cls tys =
instClassHidden = isNameHidden expInfo $ getName cls
instTypeHidden :: Bool
- instTypeHidden = any typeHidden tys
-
- nameHidden :: Name -> Bool
- nameHidden = isNameHidden expInfo
+ instTypeHidden = any (isTypeHidden expInfo) tys
+isTypeHidden :: ExportInfo -> Type -> Bool
+isTypeHidden expInfo = typeHidden
+ where
typeHidden :: Type -> Bool
typeHidden t =
case t of
@@ -213,3 +217,6 @@ isInstanceHidden expInfo cls tys =
FunTy t1 t2 -> typeHidden t1 || typeHidden t2
ForAllTy _ ty -> typeHidden ty
LitTy _ -> False
+
+ nameHidden :: Name -> Bool
+ nameHidden = isNameHidden expInfo