Add missing Semigroup instances for Monoidal datatypes in base
authorRyan Scott <ryan.gl.scott@gmail.com>
Fri, 14 Oct 2016 14:30:54 +0000 (10:30 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Fri, 14 Oct 2016 14:30:54 +0000 (10:30 -0400)
commit8c6a3d68c0301bb985aa2a462936bbcf7584ae9c
tree1b4865284dcdcf94f25af5c76fbb40f15588bc95
parent90df91a067ec6a2fccc4b740cb3006e6ff3258cf
Add missing Semigroup instances for Monoidal datatypes in base

Summary:
There are currently three datatypes that are exposed in `base` that have
`Monoid` instances, but no `Semigroup` instances:

* `IO`
* `Event` (from `GHC.Event`)
* `Lifetime` (from `GHC.Event`)

(There is also `EventLifetime` in `GHC.Event.Internal`, but it is not exported
directly, so I didn't bother with it.)

Adding the `Semigroup` instances for these types directly in the modules in
which they're defined resulted in some horrific import cycles, so I opted to
take the easy approach of defining all of these instances in `Data.Semigroup`.
(When `Semigroup` becomes a superclass of `Monoid`, these instances will have
to be moved somehow.)

Fixes #12464.

Test Plan: It compiles

Reviewers: hvr, ekmett, austin, bgamari

Reviewed By: ekmett

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2588

GHC Trac Issues: #12464
libraries/base/Data/Semigroup.hs
libraries/base/changelog.md