From 095fb18d1965353ad574b93a5d744677a1c9420a Mon Sep 17 00:00:00 2001 From: Simon Hengel Date: Sat, 26 May 2012 19:00:42 +0200 Subject: Add Applicative instance for (GenRnM a) --- src/Haddock/Interface/Rename.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Haddock/Interface') diff --git a/src/Haddock/Interface/Rename.hs b/src/Haddock/Interface/Rename.hs index 7f322eca..b703da0f 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 -- cgit v1.2.3