Add missing Semigroup instances for Monoidal datatypes in base
ClosedPublic

Authored by RyanGlScott on Oct 12 2016, 9:17 PM.

Details

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 Trac #12464.

Test Plan

It compiles

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
RyanGlScott updated this revision to Diff 8976.Oct 12 2016, 9:17 PM
RyanGlScott retitled this revision from to Add missing Semigroup instances for Monoidal datatypes in base.
RyanGlScott updated this object.
RyanGlScott edited the test plan for this revision. (Show Details)
RyanGlScott added reviewers: bgamari, austin, hvr, ekmett.
RyanGlScott updated the Trac tickets for this revision.
ekmett accepted this revision.Oct 12 2016, 9:57 PM
ekmett edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Oct 12 2016, 9:57 PM
RyanGlScott edited edge metadata.
  • Add changelog note
This revision was automatically updated to reflect the committed changes.