aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends
diff options
context:
space:
mode:
authorƁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-08-10 16:04:08 +0200
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2015-08-21 18:31:31 +0100
commit45d72d1d46dda593823bd6aedf860d18d60f3ab2 (patch)
tree9140c1eaa05fb20e1a6ac8068355ab646f684e80 /haddock-api/src/Haddock/Backends
parentfbfd09c8bf12b6991fb0aab24bf01e272f89a131 (diff)
Improve formatting of class details output in Hoogle backend.
Diffstat (limited to 'haddock-api/src/Haddock/Backends')
-rw-r--r--haddock-api/src/Haddock/Backends/Hoogle.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/haddock-api/src/Haddock/Backends/Hoogle.hs b/haddock-api/src/Haddock/Backends/Hoogle.hs
index 71e7cbc4..f4f5be90 100644
--- a/haddock-api/src/Haddock/Backends/Hoogle.hs
+++ b/haddock-api/src/Haddock/Backends/Hoogle.hs
@@ -175,6 +175,12 @@ ppClass dflags decl subdocs = (out dflags decl' ++ " " ++ ppTyFams) : ppMethods
, map (ppr . tyFamEqnToSyn . unLoc) (tcdATDefs decl)
]
+ whereWrapper elems = vcat'
+ [ text "where" <+> lbrace
+ , nest 4 . vcat . map (<> semi) $ elems
+ , rbrace
+ ]
+
addContext (TypeSig name (L l sig) nwcs) = TypeSig name (L l $ f sig) nwcs
addContext (MinimalSig src sig) = MinimalSig src sig
addContext _ = error "expected TypeSig"
@@ -390,9 +396,6 @@ escape = concatMap f
f x = [x]
-semiSeparate :: [SDoc] -> SDoc
-semiSeparate = sep . punctuate semi
-
-
-whereWrapper :: [SDoc] -> SDoc
-whereWrapper xs = text "where" <+> braces (space <> semiSeparate xs <> space)
+-- | Just like 'vcat' but uses '($+$)' instead of '($$)'.
+vcat' :: [SDoc] -> SDoc
+vcat' = foldr ($+$) empty