Proposal: Make Semigroup as a superclass of Monoid
Daniel Díaz Casanueva
dhelta.diaz at gmail.com
Sat Apr 4 13:22:58 UTC 2015
I am (+1) on adding Semigroup as superclass of Monoid, being mappend/(<>)
included in Semigroup. More than once I felt encouraged to include a
neutral element in a type where I would have gladly go without having it.
Importing semigroups from Hackage would mean to have two identical
operators, idea I do not find attractive.
About the path to choose for adoption, any of the ways described by Edward
Kmett seems good to me (I can quickly update any of my packages to the
change), but I'd rather avoid the longest one.
Daniel Díaz
On Mar 30, 2015 9:09 PM, "Edward Kmett" <ekmett at gmail.com> wrote:
> That definitely pushes me towards one of the "long" adoption paths.
>
> Here adding a Semigroup instance for Matrix actually works to get the same
> symbol, but it has a different fixity (infixr 8). Same with (<>) in the
> pretty printing libraries (infixl 6).
>
> In Data.Monoid and Data.Semigroup we have infixr 6 <>
>
> -Edward
>
>
> On Mon, Mar 30, 2015 at 2:51 PM, Henning Thielemann <
> lemming at henning-thielemann.de> wrote:
>
>>
>> On Mon, 30 Mar 2015, Edward Kmett wrote:
>>
>> Collapse the first two steps into one step, but this means that nobody
>>> gets any warning of new names coming
>>> into the Prelude. On the other hand this would get us all the way to
>>> done by 7.14. On one hand, the first
>>> order consequence the amount of breakage caused by adding Semigroup to
>>> Prelude and taking (<>) is almost
>>> entirely confined to a handful of pretty printing libraries -- and we
>>> already broke those same libraries by
>>> taking (<$>).
>>>
>>
>> Btw. hmatrix is another prominent package defining (<>) for matrix and
>> related multiplications.
>>
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150404/ae206e58/attachment.html>
More information about the Libraries
mailing list