From 986ff3c5b2e4e519171816c3ad6caa81d4808919 Mon Sep 17 00:00:00 2001 From: Simon Hengel Date: Wed, 16 May 2012 17:43:49 +0200 Subject: Use >>= instead of fmap and join --- src/Haddock/Backends/LaTeX.hs | 5 ++--- src/Haddock/Backends/Xhtml/Decl.hs | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'src/Haddock') diff --git a/src/Haddock/Backends/LaTeX.hs b/src/Haddock/Backends/LaTeX.hs index ffe507ab..efe05b9e 100644 --- a/src/Haddock/Backends/LaTeX.hs +++ b/src/Haddock/Backends/LaTeX.hs @@ -642,8 +642,7 @@ ppSideBySideConstr subdocs unicode leader (L _ con) = forall = con_explicit con -- don't use "con_doc con", in case it's reconstructed from a .hi file, -- or also because we want Haddock to do the doc-parsing, not GHC. - -- 'join' is in Maybe. - mbDoc = join $ fmap fst $ lookup (unLoc $ con_name con) subdocs + mbDoc = lookup (unLoc $ con_name con) subdocs >>= fst mkFunTy a b = noLoc (HsFunTy a b) @@ -653,7 +652,7 @@ ppSideBySideField subdocs unicode (ConDeclField (L _ name) ltype _) = <+> dcolon unicode <+> ppLType unicode ltype) <-> rDoc mbDoc where -- don't use cd_fld_doc for same reason we don't use con_doc above - mbDoc = join $ fmap fst $ lookup name subdocs + mbDoc = lookup name subdocs >>= fst -- {- -- ppHsFullConstr :: HsConDecl -> LaTeX diff --git a/src/Haddock/Backends/Xhtml/Decl.hs b/src/Haddock/Backends/Xhtml/Decl.hs index 5cdc819c..3cfba1de 100644 --- a/src/Haddock/Backends/Xhtml/Decl.hs +++ b/src/Haddock/Backends/Xhtml/Decl.hs @@ -26,7 +26,6 @@ import Haddock.Backends.Xhtml.Utils import Haddock.GhcUtils import Haddock.Types -import Control.Monad ( join ) import Data.List ( intersperse ) import qualified Data.Map as Map import Data.Maybe @@ -589,8 +588,7 @@ ppSideBySideConstr subdocs unicode qual (L _ con) = (decl, mbDoc, fieldPart) forall_ = con_explicit con -- don't use "con_doc con", in case it's reconstructed from a .hi file, -- or also because we want Haddock to do the doc-parsing, not GHC. - -- 'join' is in Maybe. - mbDoc = join $ fmap fst $ lookup (unLoc $ con_name con) subdocs + mbDoc = lookup (unLoc $ con_name con) subdocs >>= fst mkFunTy a b = noLoc (HsFunTy a b) @@ -602,7 +600,7 @@ ppSideBySideField subdocs unicode qual (ConDeclField (L _ name) ltype _) = []) where -- don't use cd_fld_doc for same reason we don't use con_doc above - mbDoc = join $ fmap fst $ lookup name subdocs + mbDoc = lookup name subdocs >>= fst ppShortField :: Bool -> Bool -> Qualification -> ConDeclField DocName -> Html -- cgit v1.2.3