From 5980cfb8eb5bf86e420c2d1b82d6d3b92c0c1fda Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Wed, 29 Jul 2015 16:51:22 +0200 Subject: Split printer of type family header to separate functions. --- haddock-api/src/Haddock/Backends/Xhtml/Decl.hs | 37 ++++++++++++++------------ 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'haddock-api') diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs index eb4524c2..e248dc25 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs @@ -239,28 +239,31 @@ ppSimpleSig links splice unicode qual loc names typ = -------------------------------------------------------------------------------- +ppFamilyInfo :: Bool -> FamilyInfo DocName -> Html +ppFamilyInfo assoc OpenTypeFamily + | assoc = keyword "type" + | otherwise = keyword "type family" +ppFamilyInfo assoc DataFamily + | assoc = keyword "data" + | otherwise = keyword "data family" +ppFamilyInfo _ (ClosedTypeFamily _) = keyword "type family" + + +ppFamilyKind :: Unicode -> Qualification -> Maybe (LHsKind DocName) -> Html +ppFamilyKind unicode qual (Just kind) = + dcolon unicode <+> ppLKind unicode qual kind +ppFamilyKind _ _ Nothing = noHtml + + ppTyFamHeader :: Bool -> Bool -> FamilyDecl DocName -> Unicode -> Qualification -> Html ppTyFamHeader summary associated d@(FamilyDecl { fdInfo = info , fdKindSig = mkind }) unicode qual = - (case info of - OpenTypeFamily - | associated -> keyword "type" - | otherwise -> keyword "type family" - DataFamily - | associated -> keyword "data" - | otherwise -> keyword "data family" - ClosedTypeFamily _ - -> keyword "type family" - ) <+> - - ppFamDeclBinderWithVars summary d <+> - - (case mkind of - Just kind -> dcolon unicode <+> ppLKind unicode qual kind - Nothing -> noHtml - ) + ppFamilyInfo associated info <+> + ppFamDeclBinderWithVars summary d <+> + ppFamilyKind unicode qual mkind + ppTyFam :: Bool -> Bool -> LinksInfo -> [DocInstance DocName] -> [(DocName, Fixity)] -> SrcSpan -> Documentation DocName -> -- cgit v1.2.3