About WrappedMonoids deprecation
John Villarreal
j0villarreal at yahoo.com
Sat Sep 14 20:36:26 UTC 2019
Hello Georgi,
I'm confused about WrappedMonoid. How can something have a Monoid instance already without having a Semigroup instance in the first place?
But also what is the benefit of WrappedMonoid over the standard way of defining Semigroups and Monoids for your example
data List a = Nil | Cons a (List a)
instance Semigroup (List a) where Nil <> ys = ys Cons x xs <> ys = Cons x (xs <> ys)
instance Monoid (List a) where mempty = Nil
?
Cheers,John
On Saturday, 14 September 2019, 19:18:01 UTC, Georgi Lyubenov <godzbanebane at gmail.com> wrote:
Hello!
Sorry if this is not the right place to ask!
As of right now (14.09.2019) Data.Semigroup.WrappedMonoid is slated to be deprecated.
I believe that this newtype is actually useful in tandem with DerivingVia, as it allows you to derive the Semigroup instance for something that has a Monoid instance already, as discussed in this twitter thread.
Would it be possible to *not* deprecate it in the future, and instead keep it around for exactly this purpose?
Cheers,
Georgi_______________________________________________
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/20190914/1aa3f9d0/attachment.html>
More information about the Libraries
mailing list