<html><head></head><body><div class="yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div id="ydpad40f7bfyahoo_quoted_8900409735" class="ydpad40f7bfyahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div dir="ltr" data-setdir="false">Hi,<br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">I wasn't aware of that. I don't understan<span>d your a) and b) points though. Semigroup is a superclass of Monoid, so doesn't that already express the necessity that everyting which is a Monoid is also a Semigroup? And there's also no boilerplate manual aliasing in my version of your example, or is it?</span><br></div><div><br></div><div><br></div><div>
                    On Saturday, 14 September 2019, 20:52:56 UTC, Georgi Lyubenov <godzbanebane@gmail.com> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="ydpad40f7bfyiv9572903978"><div><div dir="ltr">Haskell allows you to "recursively" define instances of superclasses with functions defined in subclass instances. This is fine:<br clear="none">```<br clear="none">data List a ...<br clear="none">instance Monoid (List a) ...<br clear="none">-- give a definition for mappend here<br clear="none">instance Semigroup (List a) where<br clear="none">  (<>) = mappend<br clear="none">```<br clear="none">You can do a similar thing by first defining Monad for a type and then giving implementations for Functor and Applicative by using Control.Monad.liftM and Control.Monad.ap<br clear="none">The benefit is that you can<br clear="none">a) directly express the necessity that everything which is a Monoid is also a Semigroup already<br clear="none">b) not write the boilerplate of manually aliasing (<>) to mappend<br clear="none">(and in general for bigger chains of typeclasses/more typeclass functions this becomes more convenient)</div><br clear="none"><div class="ydpad40f7bfyiv9572903978yqt4624993915" id="ydpad40f7bfyiv9572903978yqt29476"><div class="ydpad40f7bfyiv9572903978gmail_quote"><div class="ydpad40f7bfyiv9572903978gmail_attr" dir="ltr">On Sat, Sep 14, 2019 at 11:36 PM John Villarreal <<a shape="rect" href="mailto:j0villarreal@yahoo.com" rel="nofollow" target="_blank">j0villarreal@yahoo.com</a>> wrote:<br clear="none"></div><blockquote class="ydpad40f7bfyiv9572903978gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;"><div><div class="ydpad40f7bfyiv9572903978gmail-m_3481028410726621473ydp9aa3d926yahoo-style-wrap"><div></div>
        <div dir="ltr">Hello Georgi,</div><div dir="ltr"><br clear="none"></div><div dir="ltr"><br clear="none"></div><div dir="ltr">I'm confused about WrappedMonoid. How can something have a Monoid instance already without having a Semigroup instance in the first place? <br clear="none"></div><div dir="ltr"><br clear="none"></div><div dir="ltr">But also what is the benefit of WrappedMonoid over the standard way of defining Semigroups and Monoids for your example<br clear="none"></div><div dir="ltr"><br clear="none"></div><div dir="ltr"><font face="courier new, courier, monaco, monospace, sans-serif">data List a = Nil | Cons a (List a)</font></div><div dir="ltr"><font face="courier new, courier, monaco, monospace, sans-serif"><br clear="none"></font></div><div dir="ltr"><font face="courier new, courier, monaco, monospace, sans-serif">instance Semigroup (List a) where</font></div><div dir="ltr"><font face="courier new, courier, monaco, monospace, sans-serif">  Nil       <> ys = ys</font></div><div dir="ltr"><font face="courier new, courier, monaco, monospace, sans-serif">  Cons x xs <> ys = Cons x (xs <> ys)<br clear="none"></font></div><div><font face="courier new, courier, monaco, monospace, sans-serif"><br clear="none"></font></div><div dir="ltr"><font face="courier new, courier, monaco, monospace, sans-serif">instance Monoid (List a) where mempty = Nil</font></div><div dir="ltr"><br clear="none"></div><div dir="ltr"><div><div dir="ltr">?</div><div dir="ltr"><br clear="none"></div><div dir="ltr">Cheers,</div><div dir="ltr">John<br clear="none"></div><div dir="ltr"><br clear="none"></div></div><div><br clear="none"></div></div>
        
        </div><div class="ydpad40f7bfyiv9572903978gmail-m_3481028410726621473yahoo_quoted" id="ydpad40f7bfyiv9572903978gmail-m_3481028410726621473yahoo_quoted_9208345914">
            <div>
                
                <div>
                    On Saturday, 14 September 2019, 19:18:01 UTC, Georgi Lyubenov <<a shape="rect" href="mailto:godzbanebane@gmail.com" rel="nofollow" target="_blank">godzbanebane@gmail.com</a>> wrote:
                </div>
                <div><br clear="none"></div>
                <div><br clear="none"></div>
                <div><div id="ydpad40f7bfyiv9572903978gmail-m_3481028410726621473yiv9943144451"><div dir="ltr">Hello!<br clear="none"><br clear="none">Sorry if this is not the right place to ask!<br clear="none"><br clear="none">As of right now (14.09.2019) Data.Semigroup.WrappedMonoid <a shape="rect" href="https://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Semigroup.html#t:WrappedMonoid" rel="nofollow" target="_blank">is slated to be deprecated</a>.<br clear="none"><br clear="none">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, <a shape="rect" href="https://twitter.com/googleson78/status/1172944490597945344" rel="nofollow" target="_blank">as discussed in this twitter thread</a>.<br clear="none"><br clear="none">Would it be possible to *not* deprecate it in the future, and instead keep it around for exactly this purpose?<br clear="none"><br clear="none">Cheers,<br clear="none">Georgi</div></div>_______________________________________________<br clear="none">Libraries mailing list<br clear="none"><a shape="rect" href="mailto:Libraries@haskell.org" rel="nofollow" target="_blank">Libraries@haskell.org</a><br clear="none"><a shape="rect" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="nofollow" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br clear="none"></div>
            </div>
        </div></div></blockquote></div></div></div></div></div>
            </div>
        </div></div></body></html>