[commit: haddock] ghc-7.4: Use >>= instead of fmap and join (986ff3c)

David Waern waern at galois.com
Sun May 27 01:46:52 CEST 2012


Repository : ssh://darcs.haskell.org//srv/darcs/haddock

On branch  : ghc-7.4

http://hackage.haskell.org/trac/ghc/changeset/986ff3c5b2e4e519171816c3ad6caa81d4808919

>---------------------------------------------------------------

commit 986ff3c5b2e4e519171816c3ad6caa81d4808919
Author: Simon Hengel <sol at typeful.net>
Date:   Wed May 16 17:43:49 2012 +0200

    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(-)

diff --git a/src/Haddock/Backends/LaTeX.hs b/src/Haddock/Backends/LaTeX.hs
index ffe507a..efe05b9 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 5cdc819..3cfba1d 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





More information about the Cvs-ghc mailing list