aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Backends
diff options
context:
space:
mode:
authorNeil Mitchell <unknown>2008-06-26 00:28:10 +0000
committerNeil Mitchell <unknown>2008-06-26 00:28:10 +0000
commit9728fda4c7001b2770d721307a142c92cbba23a8 (patch)
tree23ce3d317d66edbbb069c36f9d8deb25dd2eb595 /src/Haddock/Backends
parentdb75d9fee7d48de8b7e12745e711a9a44b86961c (diff)
Change how the Hoogle backend outputs classes, adding the context in
Diffstat (limited to 'src/Haddock/Backends')
-rw-r--r--src/Haddock/Backends/Hoogle.hs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Haddock/Backends/Hoogle.hs b/src/Haddock/Backends/Hoogle.hs
index 53d99846..bda246ac 100644
--- a/src/Haddock/Backends/Hoogle.hs
+++ b/src/Haddock/Backends/Hoogle.hs
@@ -61,6 +61,7 @@ ppModule iface = "" : doc (ifaceDoc iface) ++
indent = (++) " "
unL (L _ x) = x
+reL = L undefined
dropComment (' ':'-':'-':' ':_) = []
@@ -95,7 +96,17 @@ ppExport _ = []
-- note: does not yet output documentation for class methods
ppClass :: TyClDecl Name -> [String]
ppClass x = out x{tcdSigs=[]} :
- map (indent . out) (tcdSigs x)
+ map (out . addContext . unL) (tcdSigs x)
+ where
+ addContext (TypeSig name (L l sig)) = TypeSig name (L l $ f sig)
+ f (HsForAllTy a b con d) = HsForAllTy a b (reL $ context : unL con) d
+ f x = HsForAllTy Implicit [] (reL [context]) (reL x)
+
+ context = reL $ HsClassP (unL $ tcdLName x)
+ (map (reL . HsTyVar . tyVar . unL) (tcdTyVars x))
+
+ tyVar (UserTyVar x) = x
+ tyVar (KindedTyVar x _) = x
ppInstance :: Instance -> [String]