[GHC] #10365: Implement Semigroup as a superclass of Monoid Proposal (Phase 1)

GHC ghc-devs at haskell.org
Sun Nov 1 18:13:01 UTC 2015


#10365: Implement Semigroup as a superclass of Monoid Proposal (Phase 1)
-------------------------------------+-------------------------------------
        Reporter:  gidyn             |                Owner:  quchen
            Type:  feature request   |               Status:  patch
        Priority:  high              |            Milestone:  8.0.1
       Component:  libraries/base    |              Version:  7.10.1
      Resolution:                    |             Keywords:  report-impact
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D1284
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by ekmett):

 @rwbarton: The short version of it is this: We have `mconcat` for `Monoid`
 today. It actually sees a fair bit of use and I've seen folks implement it
 in the wild to do things like Kahan summation or better short circuiting
 than the base monoid can (it gets to assume an associativity.) `fold` gets
 to know the container, `mconcat` gets to know the Monoid.

 The moral equivalent in `Semigroup` requires some form of canonical non-
 empty type to fold over. The net effect of removing it is that the
 `semigroups` package would continue to exist just to supply this type, the
 class would lose its canonical structure to fold over, and `sconcat`
 becomes unimplementable.

 Why should moving `Semigroup` into `base` cost users functionality?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10365#comment:31>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list