summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/Base.hs
diff options
context:
space:
mode:
authorGabriel Gonzalez <Gabriel439@gmail.com>2015-06-16 16:38:18 -0500
committerAustin Seipp <austin@well-typed.com>2015-06-16 16:39:43 -0500
commit65d4b895d8331ff9e7df6aaf0a0de898c857201c (patch)
tree50c10a968abbd9444ab6a231c650ea9c0dfd6b58 /libraries/base/GHC/Base.hs
parentdaf1eee4cdfeba6af77dafe3561fe178b9f30f11 (diff)
downloadhaskell-65d4b895d8331ff9e7df6aaf0a0de898c857201c.tar.gz
Add `Monoid` instance for `IO`
See original proposal at https://mail.haskell.org/pipermail/libraries/2014-November/024310.html for more details Reviewed By: hvr, austin Differential Revision: https://phabricator.haskell.org/D988 GHC Trac Issues: #10523
Diffstat (limited to 'libraries/base/GHC/Base.hs')
-rw-r--r--libraries/base/GHC/Base.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs
index 79942d827d..e15519d1fc 100644
--- a/libraries/base/GHC/Base.hs
+++ b/libraries/base/GHC/Base.hs
@@ -312,6 +312,10 @@ instance Monoid a => Monad ((,) a) where
return x = (mempty, x)
(u, a) >>= k = case k a of (v, b) -> (u `mappend` v, b)
+instance Monoid a => Monoid (IO a) where
+ mempty = pure mempty
+ mappend = liftA2 mappend
+
{- | The 'Functor' class is used for types that can be mapped over.
Instances of 'Functor' should satisfy the following laws: