[commit: haddock] ghc-7.4: Add Applicative instance for (GenRnM a) (095fb18)
David Waern
waern at galois.com
Sun May 27 01:46:54 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/haddock
On branch : ghc-7.4
http://hackage.haskell.org/trac/ghc/changeset/095fb18d1965353ad574b93a5d744677a1c9420a
>---------------------------------------------------------------
commit 095fb18d1965353ad574b93a5d744677a1c9420a
Author: Simon Hengel <sol at typeful.net>
Date: Sat May 26 19:00:42 2012 +0200
Add Applicative instance for (GenRnM a)
>---------------------------------------------------------------
src/Haddock/Interface/Rename.hs | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/Haddock/Interface/Rename.hs b/src/Haddock/Interface/Rename.hs
index 7f322ec..b703da0 100644
--- a/src/Haddock/Interface/Rename.hs
+++ b/src/Haddock/Interface/Rename.hs
@@ -97,6 +97,10 @@ instance Monad (GenRnM n) where
instance Functor (GenRnM n) where
fmap f x = do a <- x; return (f a)
+instance Applicative (GenRnM n) where
+ pure = return
+ (<*>) = ap
+
returnRn :: a -> GenRnM n a
returnRn a = RnM (const (a,[]))
thenRn :: GenRnM n a -> (a -> GenRnM n b) -> GenRnM n b
@@ -144,12 +148,12 @@ renameExportItems = mapM renameExportItem
renameDocForDecl :: DocForDecl Name -> RnM (DocForDecl DocName)
renameDocForDecl (doc, fnArgsDoc) =
- (,) `fmap` renameDocumentation doc `ap` renameFnArgsDoc fnArgsDoc
+ (,) <$> renameDocumentation doc <*> renameFnArgsDoc fnArgsDoc
renameDocumentation :: Documentation Name -> RnM (Documentation DocName)
renameDocumentation (Documentation mDoc mWarning) =
- Documentation `fmap` mapM renameDoc mDoc `ap` mapM renameDoc mWarning
+ Documentation <$> mapM renameDoc mDoc <*> mapM renameDoc mWarning
renameLDocHsSyn :: LHsDocString -> RnM LHsDocString
More information about the Cvs-ghc
mailing list