diff options
author | David Waern <david.waern@gmail.com> | 2011-06-11 00:33:33 +0000 |
---|---|---|
committer | David Waern <david.waern@gmail.com> | 2011-06-11 00:33:33 +0000 |
commit | ab24835eadb99059934d7a14f86564eea6449257 (patch) | |
tree | 8ba6e31d9162a8ec69b437ceace3bb95be01f91b /src/Haddock/Backends/Xhtml.hs | |
parent | ae5ed291f3c1550b0eda7bb0585ead327b5d967e (diff) |
* Merge in git patch from Michal Terepeta
From 6fc71d067738ef4b7de159327bb6dc3d0596be29 Mon Sep 17 00:00:00 2001
From: Michal Terepeta <michal.terepeta@gmail.com>
Date: Sat, 14 May 2011 19:18:22 +0200
Subject: [PATCH] Follow the change of TypeSig in GHC.
This follows the change in GHC to make TypeSig take a list
of names (instead of just one); GHC ticket #1595. This
should also improve the Haddock output in case the user
writes a type signature that refers to many names:
-- | Some comment..
foo, bar :: ...
will now generate the expected output with one signature for
both names.
Diffstat (limited to 'src/Haddock/Backends/Xhtml.hs')
-rw-r--r-- | src/Haddock/Backends/Xhtml.hs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/Haddock/Backends/Xhtml.hs b/src/Haddock/Backends/Xhtml.hs index 3bc2dd6f..d3d3c79c 100644 --- a/src/Haddock/Backends/Xhtml.hs +++ b/src/Haddock/Backends/Xhtml.hs @@ -547,31 +547,31 @@ ifaceToHtml maybe_source_url maybe_wiki_url iface unicode qual miniSynopsis :: Module -> Interface -> Bool -> Qualification -> Html miniSynopsis mdl iface unicode qual = - divInterface << mapMaybe (processForMiniSynopsis mdl unicode qual) exports + divInterface << concatMap (processForMiniSynopsis mdl unicode qual) exports where exports = numberSectionHeadings (ifaceRnExportItems iface) processForMiniSynopsis :: Module -> Bool -> Qualification -> ExportItem DocName - -> Maybe Html + -> [Html] processForMiniSynopsis mdl unicode _ (ExportDecl (L _loc decl0) _doc _ _insts) = ((divTopDecl <<).(declElem <<)) `fmap` case decl0 of TyClD d -> let b = ppTyClBinderWithVarsMini mdl d in case d of - (TyFamily{}) -> Just $ ppTyFamHeader True False d unicode + (TyFamily{}) -> [ppTyFamHeader True False d unicode] (TyData{tcdTyPats = ps}) - | Nothing <- ps -> Just $ keyword "data" <+> b - | Just _ <- ps -> Just $ keyword "data" <+> keyword "instance" <+> b + | Nothing <- ps -> [keyword "data" <+> b] + | Just _ <- ps -> [keyword "data" <+> keyword "instance" <+> b] (TySynonym{tcdTyPats = ps}) - | Nothing <- ps -> Just $ keyword "type" <+> b - | Just _ <- ps -> Just $ keyword "type" <+> keyword "instance" <+> b - (ClassDecl {}) -> Just $ keyword "class" <+> b - _ -> Nothing - SigD (TypeSig (L _ n) (L _ _)) -> - Just $ ppNameMini mdl (nameOccName . getName $ n) - _ -> Nothing + | Nothing <- ps -> [keyword "type" <+> b] + | Just _ <- ps -> [keyword "type" <+> keyword "instance" <+> b] + (ClassDecl {}) -> [keyword "class" <+> b] + _ -> [] + SigD (TypeSig lnames (L _ _)) -> + map (ppNameMini mdl . nameOccName . getName . unLoc) lnames + _ -> [] processForMiniSynopsis _ _ qual (ExportGroup lvl _id txt) = - Just $ groupTag lvl << docToHtml qual txt -processForMiniSynopsis _ _ _ _ = Nothing + [groupTag lvl << docToHtml qual txt] +processForMiniSynopsis _ _ _ = [] ppNameMini :: Module -> OccName -> Html |