Skip to content
Snippets Groups Projects
Commit 095fb18d authored by Simon Hengel's avatar Simon Hengel
Browse files

Add Applicative instance for (GenRnM a)

parent 37e0abeb
No related branches found
No related tags found
5 merge requests!38Make --no-tmp-comp-dir the default,!37Adapt to latest xhtml version, various optimizations,!31Support HsToken in DataDecl and ClassDecl,!12Drop orphan instance when defined upstream.,!10Haddock interfaces produced from `.hi` files
...@@ -97,6 +97,10 @@ instance Monad (GenRnM n) where ...@@ -97,6 +97,10 @@ instance Monad (GenRnM n) where
instance Functor (GenRnM n) where instance Functor (GenRnM n) where
fmap f x = do a <- x; return (f a) fmap f x = do a <- x; return (f a)
instance Applicative (GenRnM n) where
pure = return
(<*>) = ap
returnRn :: a -> GenRnM n a returnRn :: a -> GenRnM n a
returnRn a = RnM (const (a,[])) returnRn a = RnM (const (a,[]))
thenRn :: GenRnM n a -> (a -> GenRnM n b) -> GenRnM n b thenRn :: GenRnM n a -> (a -> GenRnM n b) -> GenRnM n b
...@@ -144,12 +148,12 @@ renameExportItems = mapM renameExportItem ...@@ -144,12 +148,12 @@ renameExportItems = mapM renameExportItem
renameDocForDecl :: DocForDecl Name -> RnM (DocForDecl DocName) renameDocForDecl :: DocForDecl Name -> RnM (DocForDecl DocName)
renameDocForDecl (doc, fnArgsDoc) = renameDocForDecl (doc, fnArgsDoc) =
(,) `fmap` renameDocumentation doc `ap` renameFnArgsDoc fnArgsDoc (,) <$> renameDocumentation doc <*> renameFnArgsDoc fnArgsDoc
renameDocumentation :: Documentation Name -> RnM (Documentation DocName) renameDocumentation :: Documentation Name -> RnM (Documentation DocName)
renameDocumentation (Documentation mDoc mWarning) = renameDocumentation (Documentation mDoc mWarning) =
Documentation `fmap` mapM renameDoc mDoc `ap` mapM renameDoc mWarning Documentation <$> mapM renameDoc mDoc <*> mapM renameDoc mWarning
renameLDocHsSyn :: LHsDocString -> RnM LHsDocString renameLDocHsSyn :: LHsDocString -> RnM LHsDocString
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment