aboutsummaryrefslogtreecommitdiff
path: root/src/HaddockUtil.hs
diff options
context:
space:
mode:
authorsimonmar <unknown>2002-05-27 09:03:52 +0000
committersimonmar <unknown>2002-05-27 09:03:52 +0000
commita4e4c5f822416dbe2b8abe34301e8d3e39051bc1 (patch)
tree48743b04e3ebced1288b7ee51700f01fb4d02fa3 /src/HaddockUtil.hs
parent01c2ddd27ae8776b03464d091d6dce989b7ee13f (diff)
[haddock @ 2002-05-27 09:03:51 by simonmar]
Lots of changes: - instances of a class are listed with the class, and instances involving a datatype are listed with that type. Derived instances aren't included at the moment: the calculation to find the instance head for a derived instance is non-trivial. - some formatting changes; use rows with specified height rather than cellspacing in some places. - various fixes (source file links were wrong, amongst others)
Diffstat (limited to 'src/HaddockUtil.hs')
-rw-r--r--src/HaddockUtil.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/HaddockUtil.hs b/src/HaddockUtil.hs
index 58033edc..27595f33 100644
--- a/src/HaddockUtil.hs
+++ b/src/HaddockUtil.hs
@@ -9,7 +9,7 @@ module HaddockUtil (
-- * Misc utilities
nameOfQName, collectNames, declBinders, declMainBinder, splitTyConApp,
- restrictTo, declDoc, parseModuleHeader,
+ restrictTo, declDoc, parseModuleHeader, freeTyCons,
-- * Filename utilities
basename, dirname, splitFilename3,
@@ -76,6 +76,16 @@ splitTyConApp t = split t []
split (HsTyCon t) ts = (t,ts)
split _ _ = error "splitTyConApp"
+freeTyCons :: HsType -> [HsQName]
+freeTyCons ty = go ty []
+ where go (HsForAllType _ _ t) r = go t r
+ go (HsTyApp t u) r = go t (go u r)
+ go (HsTyCon c) r = c : r
+ go (HsTyFun f a) r = go f (go a r)
+ go (HsTyTuple b ts) r = foldr go r ts
+ go (HsTyVar v) r = r
+ go (HsTyDoc t _) r = go t r
+
-- ---------------------------------------------------------------------------
-- Making abstract declarations