Commit 65d4b895 authored by Gabriella439's avatar Gabriella439 Committed by Austin Seipp
Browse files

Add `Monoid` instance for `IO`

See original proposal at
for more details

Reviewed By: hvr, austin

Differential Revision:

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
## *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