Commit 65d4b895 authored by Gabriel439's avatar Gabriel439 Committed by Austin Seipp

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
parent daf1eee4
......@@ -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:
......
......@@ -35,6 +35,8 @@
* `Data.Version.Version` now has a `Generic` instance
* `IO` now has a `Monoid` instance
## 4.8.1.0 *TBA*
* Bundled with GHC 7.10.2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment