<div dir="ltr">> <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">It is sometimes useful for things like configuration, where a proper Monoid instance would be tricky and unnecessary. Other than this, I don't know of any legitimate uses.<br><br>Configuration records have a fantastic monoid instance. `mempty` provides your defaults, and `mappend` provides an update. So you can do `mempty <> fileConfiguration <> environmentVariables <> commandLineArgs` (or you can flip the bias to get whatever overriding behavior you want). With `DerivingVia`, we should be able to make this derivable, using the First/Last semigroups/monoids and the isomorphism between tuples and product types.<br></span><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I'm weakly opposed to this type class as `def :: Foo` is less ergonomic than `defFoo`, and I'm never polymorphic over what I want a default in. But, as someone that doesn't want to use it, I don't have much of a say in how it gets run or maintained :) </span></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Matt Parsons</div></div></div></div>
<br><div class="gmail_quote">On Tue, May 8, 2018 at 3:39 AM, Marco Zocca <span dir="ltr"><<a href="mailto:zocca.marco@gmail.com" target="_blank">zocca.marco@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">While I very much agree with all of you on the need for solid<br>
typeclass laws, I think Default still has its place in the library<br>
author toolkit .<br>
<br>
Think for example of configuration data for very flexible<br>
functionality such as plotting.<br>
<br>
On the other hand, if it's such a bad idea, what's a good course of<br>
action in this case ? Take over and deprecate ?<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
On Tue, May 8, 2018 at 11:21 AM, Chris Wong <<a href="mailto:lambda.fairy@gmail.com">lambda.fairy@gmail.com</a>> wrote:<br>
> On Tue, May 8, 2018 at 9:10 PM, Marco Zocca <<a href="mailto:zocca.marco@gmail.com">zocca.marco@gmail.com</a>> wrote:<br>
>><br>
>> data-default alone is depended on by > 500 packages :<br>
>> <a href="http://packdeps.haskellers.com/reverse/data-default" rel="noreferrer" target="_blank">http://packdeps.haskellers.<wbr>com/reverse/data-default</a><br>
>><br>
>> Could you motivate why it's not a good idea ?<br>
>><br>
><br>
> I can think of two reasons:<br>
><br>
> - It has no laws, so there's formal specification that tells us whether an<br>
> instance is "correct" or not.<br>
><br>
> - Type classes are useful when there is a large family of generic operations<br>
> that can work with them. For example, the utility functions in Control.Monad<br>
> [1] are used in all kinds of Haskell programs. But there are no such generic<br>
> operations that apply to all Default instances.<br>
><br>
> That said -- as you note, it's has quite a few dependents so it's great that<br>
> someone is stepping up to maintain it regardless.<br>
><br>
> Chris<br>
><br>
> [1]<br>
> <a href="https://hackage.haskell.org/package/base-4.11.1.0/docs/Control-Monad.html#g:4" rel="noreferrer" target="_blank">https://hackage.haskell.org/<wbr>package/base-4.11.1.0/docs/<wbr>Control-Monad.html#g:4</a><br>
><br>
>><br>
>><br>
>> On Tue, May 8, 2018 at 11:02 AM, Christopher Allen <<a href="mailto:cma@bitemyapp.com">cma@bitemyapp.com</a>><br>
>> wrote:<br>
>> > Is this something folks still think is a good idea? I purge<br>
>> > Data.Default from projects I work on.<br>
>> ><br>
>> > On Tue, May 8, 2018 at 3:58 AM, Marco Zocca <<a href="mailto:zocca.marco@gmail.com">zocca.marco@gmail.com</a>><br>
>> > wrote:<br>
>> >> Dear all,<br>
>> >><br>
>> >>   I've been increasingly relying on data-default-class, but sadly it<br>
>> >> doesn't look like it's currently maintained; there are some tickets on<br>
>> >> the github issue tracker that would need some attention.<br>
>> >><br>
>> >> I have tried contacting the authro/current maintainer Lukas Mai (CC'd)<br>
>> >> by email but have not received an answer so far (I hope he's doing<br>
>> >> well, btw).<br>
>> >><br>
>> >> This is my first public request for taking over the `data-default`<br>
>> >> family of packages:<br>
>> >><br>
>> >> data-default-class<br>
>> >> data-default-instances-base<br>
>> >> data-default-instances-<wbr>containers<br>
>> >> data-default-instances-dlist<br>
>> >> data-default-instances-old-<wbr>locale<br>
>> >> data-default<br>
>> >><br>
>> >> Kind regards,<br>
>> >> Marco Zocca<br>
>> >> (<a href="http://hackage.haskell.org/user/ocramz" rel="noreferrer" target="_blank">http://hackage.haskell.org/<wbr>user/ocramz</a>)<br>
>> >> ______________________________<wbr>_________________<br>
>> >> Libraries mailing list<br>
>> >> <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
>> >> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/libraries</a><br>
>> ><br>
>> ><br>
>> ><br>
>> > --<br>
>> > Chris Allen<br>
>> > Currently working on <a href="http://haskellbook.com" rel="noreferrer" target="_blank">http://haskellbook.com</a><br>
>> ______________________________<wbr>_________________<br>
>> Haskell-Cafe mailing list<br>
>> To (un)subscribe, modify options or view archives go to:<br>
>> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/haskell-<wbr>cafe</a><br>
>> Only members subscribed via the mailman list are allowed to post.<br>
><br>
><br>
><br>
><br>
> --<br>
> Chris Wong (<a href="https://lambda.xyz" rel="noreferrer" target="_blank">https://lambda.xyz</a>)<br>
><br>
> "I had not the vaguest idea what this meant and when I could not remember<br>
> the words, my tutor threw the book at my head, which did not stimulate my<br>
> intellect in any way." -- Bertrand Russell<br>
______________________________<wbr>_________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/haskell-<wbr>cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</div></div></blockquote></div><br></div>