Monoid instance for IO

Herbert Valerio Riedel hvr at gnu.org
Fri Nov 14 11:42:31 UTC 2014


On 2014-11-13 at 16:13:09 +0100, Gabriel Gonzalez wrote:
> I would like to add the following `Monoid` instance for `IO` to
> Data.Monoid`:
>
> ```
> instance Monoid a => Monoid (IO a) where
>    mempty  = pure mempty
>    mappend = liftA2 mappend
> ```

seems reasonable to me, +1 from me

Cheers,
  hvr

PS: There was a related discussion earlier this year at
    http://thread.gmane.org/gmane.comp.lang.haskell.glasgow.user/24835/focus=24836
    mentioning "instance Monoid a => Monoid (IO a)" already


More information about the Libraries mailing list