About WrappedMonoids deprecation

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 https://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Semigroup.html#t... . 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 https://twitter.com/googleson78/status/1172944490597945344. Would it be possible to *not* deprecate it in the future, and instead keep it around for exactly this purpose? Cheers, Georgi

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

The point is that someone can write
instance Monoid Thingy where
mempty = <something>
mappend a b = <something else>
mconcat ls = <another thing>
deriving instance Semigroup Thingy via (WrappedMonoid Thingy)
Most of the benefit is not having to look up "stimesMonoid" over and over again.
On Sat, Sep 14, 2019 at 3:36 PM John Villarreal via Libraries
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
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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

Although the example you give works today, it would stop working if mappend
ever stopped being a typeclass method of Monoid. I cannot remember if this
is on the roadmap. It's certainly not happening any time soon, but it may
happen eventually. (It's similar in spirit to removing return from Monad)
On Sat, Sep 14, 2019 at 4:48 PM Zemyla
The point is that someone can write
instance Monoid Thingy where mempty = <something> mappend a b = <something else> mconcat ls = <another thing>
deriving instance Semigroup Thingy via (WrappedMonoid Thingy)
Most of the benefit is not having to look up "stimesMonoid" over and over again.
On Sat, Sep 14, 2019 at 3:36 PM John Villarreal via Libraries
wrote: 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@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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
-- -Andrew Thaddeus Martin
participants (4)
-
Andrew Martin
-
Georgi Lyubenov
-
John Villarreal
-
Zemyla