diff options
author | Neil Mitchell <unknown> | 2008-06-26 00:28:10 +0000 |
---|---|---|
committer | Neil Mitchell <unknown> | 2008-06-26 00:28:10 +0000 |
commit | 9728fda4c7001b2770d721307a142c92cbba23a8 (patch) | |
tree | 23ce3d317d66edbbb069c36f9d8deb25dd2eb595 /src/Haddock/Backends | |
parent | db75d9fee7d48de8b7e12745e711a9a44b86961c (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.hs | 13 |
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] |