diff options
author | Gabriel Gonzalez <Gabriel439@gmail.com> | 2015-06-16 16:38:18 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2015-06-16 16:39:43 -0500 |
commit | 65d4b895d8331ff9e7df6aaf0a0de898c857201c (patch) | |
tree | 50c10a968abbd9444ab6a231c650ea9c0dfd6b58 /libraries/base/GHC/Base.hs | |
parent | daf1eee4cdfeba6af77dafe3561fe178b9f30f11 (diff) | |
download | haskell-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.hs | 4 |
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: |