<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>Hooray! I'm happy to hear that my proposal has been accepted and `singleton` will be added to `Data.List` in the next major release of GHC. I'm also excited about making functions in `Data.List` monomorphic to lists. I look forward to that change!<br></div><div><br></div><div>I'd like to take a moment to thank my team at ITProTV for motivating this proposal. I'd also like to thank the community, both here and elsewhere, for the spirited discussion about this proposal. And finally I'd like to thank the Core Libraries Committee for ultimately decided on this proposal. I appreciate all of you! <br></div><div><br></div><div>Lastly, should I submit a patch for this? I would be happy to, but the code involved is minimal and I don't mind if someone else wants to actually commit it. You can see the code and documentation that I would commit here: <a href="https://hackage.haskell.org/package/list-singleton-1.0.0.2/docs/Data-List-Singleton.html#v:singleton">https://hackage.haskell.org/package/list-singleton-1.0.0.2/docs/Data-List-Singleton.html#v:singleton</a><br></div><div><br></div><div>On Sun, Sep 8, 2019, at 10:38 PM, Edward Kmett wrote:<br></div><blockquote type="cite" id="qt"><div dir="ltr"><div><a href="https://groups.google.com/forum/#!forum/haskell-core-libraries">https://groups.google.com/forum/#!forum/haskell-core-libraries</a> should link to the CLC mailing list archive. As far as I can tell it should be public.<br></div><div><br></div><div>-Edward<br></div></div><div><br></div><div class="qt-gmail_quote"><div class="qt-gmail_attr" dir="ltr">On Sat, Sep 7, 2019 at 11:53 PM Helmut Schmidt <<a href="mailto:helmut.schmidt.4711@gmail.com">helmut.schmidt.4711@gmail.com</a>> wrote:<br></div><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div dir="ltr"><div><br></div><div>Am So., 8. Sept. 2019 um 05:59 Uhr schrieb Edward Kmett <<a href="mailto:ekmett@gmail.com">ekmett@gmail.com</a>>:<br></div><div class="qt-gmail_quote"><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div dir="ltr">To grant some insight into what is going on behind closed doors. I figured I'd unpack a bit of it here.<br></div></blockquote><div><br></div><div><div>Why is it necessary this gets discussed behind closed doors in the first place? Why can't we get more insight into the decision process of such a highly controversial proposal?<br></div></div><div> <br></div><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div dir="ltr"><div><br></div><div>The current resolution is to treat this as step one in a longer maneuver.<br></div><div><br></div><div><i>We'll be adding </i><span style="font-family:monospace" class="font">singleton</span><i> to </i><span style="font-family:monospace" class="font">Data.List</span><i>, immediately.</i><br></div><div><br></div><div>The headache has really been the issue mentioned above wherein <span style="font-family:monospace" class="font">Data.List</span> has historically been treated as an unqualified export that shouldn't clash with the <span style="font-family:monospace" class="font">Prelude</span> in any way. <br></div><div><br></div><div>This is mostly a historical accident and doesn't really match up with the way any of the other "container" like modules are expected to be used. It has led to the somewhat messy state of dozens of other combinators in <span style="font-family:monospace" class="font">Data.List </span><span style="font-family:arial, sans-serif" class="font">such as </span><span style="font-family:monospace" class="font">foldr</span> having to be generalized by the <span style="font-family:monospace" class="font">Foldable</span>/<span style="font-family:monospace" class="font">Traversable</span> Proposal and other language warts starting to accumulate over time. It is disproportionately difficult to add things to <span style="font-family:monospace" class="font">Data.List,</span> so we're going to fix that. -- We'd intended to fix that wart since GHC 7.10, but lacked a sufficient forcing function. Expanding the API of <span style="font-family:monospace" class="font">Data.List</span> is acting as that forcing function.<br></div><div><br></div><div><i>We are going to be switching the usage pattern for </i><span style="font-family:monospace" class="font">Data.List</span><i> to expect a qualified or explicit import list like </i><span style="font-family:monospace" class="font">Data.Text</span>, <span style="font-family:monospace" class="font">Data.ByteString</span>, <span style="font-family:monospace" class="font">Data.Set</span>,<i> etc.</i><br></div><div><div><br></div><div>This also helps allow for easier expansion of <span style="font-family:monospace" class="font">Data.List</span>, which has been pretty stagnant other than a non-report-specified <span style="font-family:monospace" class="font">uncons</span> slipping in stealthily in GHC 7.10.<br></div><div><br></div><div><br></div></div><div><div>It also helps ameliorate any long term concerns with this taking a name, as it is now something placed in a module where name collisions are okay, as usage is qualified or explicit. Meanwhile, Ryan GL Scott managed to accumulate enough data to show that breakage this one combinator would introduce was pretty minor after all, so we're going to go ahead with adding <span style="font-family:monospace" class="font">singleton</span> before the rest of this happens.<br></div><div><div><div><br></div></div><div><br></div></div><div><br></div></div><div>To get <i>there</i>, we'll need a slightly longer timeline, and some support from GHC HQ to craft an appropriate warning. This will allow us to monomorphize the combinators in <span style="font-family:monospace" class="font">Data.List</span> yielding a sane ending state that doesn't require a PhD in the History of Haskell to fully understand, and we'll be able to retire <span style="font-family:monospace" class="font">GHC.OldList</span> once an appropriate 3-release policy compatible migration plan has been fully hammered out.<br></div><div><br></div><div>Normally, I'd wait until we had a full plan with all the migration issues posted rather than shooting off half-cocked like this, but I wanted to be clear about what was causing the communication delay.<br></div><div><br></div><div>-Edward<br></div></div><div><br></div><div class="qt-gmail_quote"><div class="qt-gmail_attr" dir="ltr">On Wed, Aug 28, 2019 at 12:57 PM Keith <<a href="mailto:keith.wygant@gmail.com">keith.wygant@gmail.com</a>> wrote:<br></div><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div><div>For what it's worth, when starting out I found the disconnect between list sugar and list constructor/destructors extremely confusing.<br></div><div> In retrospect it seems pretty silly, but I could not figure out how lists were consumed as (x : xs) but often produced with [x, x1, ...]. Mistakes like [x, xs] were common.<br></div><div> When I finally realized that I could construct lists with the list constuctors, I started using them exclusively.<br></div><div><br></div><div>Simplcity and straightforwardness help understanding. It was much easier for me to understand a singleton list as (x : []) than [x]. Having to deal with '(singleton x)' (at the time not knowing the definition of 'singleton') would have been another layer of confusion.<br></div><div><br></div><div>I get that 'singleton' is library design, since in shows up in Map, Array, Set, etc. But for me trying to use lists, it would have only been useful if I defined it myself as a way to learn that constuctors are fuctions, and that 'singleton' means 'single'.<br></div><div><br></div><div class="qt-gmail_quote"><div>On August 23, 2019 7:56:41 AM UTC, Sven Panne <<a href="mailto:svenpanne@gmail.com">svenpanne@gmail.com</a>> wrote:<br></div><blockquote style="margin-top:0pt;margin-right:0pt;margin-bottom:0pt;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div dir="ltr"><div dir="ltr">Am Do., 22. Aug. 2019 um 19:11 Uhr schrieb Kris Nuttycombe <<a href="mailto:kris.nuttycombe@gmail.com">kris.nuttycombe@gmail.com</a>>:<br></div><div class="qt-gmail_quote"><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div dir="ltr"><div dir="ltr"><br></div><div class="qt-gmail_quote"><div class="qt-gmail_attr" dir="ltr">On Thu, Aug 22, 2019 at 3:58 AM Sven Panne <<a href="mailto:svenpanne@gmail.com">svenpanne@gmail.com</a>> wrote:<br></div><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div dir="ltr"><div class="qt-gmail_quote"><div class="qt-gmail_attr" dir="ltr"> I think there's a significant difference between "little helper" and "the monomorphic function that is used to implement `pure`" - with a slightly different framing, we might be able to come to an agreement that both the monomorphic an polymorphic versions of this function are useful in different contexts. [...]<br></div></div></div></blockquote></div></div></blockquote><div><br></div><div>I think we can agree that we disagree here. ;-) My brain is too small to remember the names of myriads of trivial helpers, so I very much prefer general, orthogonal things. In our case: If we have a general, polymorphic function (often from a type class), just use that. If for some reason (rarely!) I want a more monomorphic function, I can just add a plain old type signature somewhere (no need for funky language extensions like type applications). This radically reduces the number of things one has to remember. In our case: Know type classes + know a way to make things more monomorphic.<br></div><div> <br></div><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div dir="ltr"><div class="qt-gmail_quote"><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div dir="ltr"><div class="qt-gmail_quote"><div class="qt-gmail_attr" dir="ltr"><br></div></div></div></blockquote><div>My guiding principle for API design is that one should always expose the fundamental building blocks as a low-level API, and then provide a smaller interface for the common use cases. Typeclass instances are no different - they are the general interface that allows us to invoke what is ultimately a monomorphic, low-level building block function in a polymorphic context. <br></div></div></div></blockquote><div><br></div><div>This is exactly the opposite API design principle I have: Do not expose the monomorphic functions if they are already in a type class. You can easily reconstruct them as a library user via type signtures if this is really needed (still haven't seen many convincing examples of that), but you can' do it the other way round. Less things exposed, no generality/use cases lost => easier to remember.<br></div><div><br></div><div>The thing we can probably agree on: API design is hard and it's not an exact science, more a kind of art which is assessed in a subjective way... :-)<br></div><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><br></blockquote></div></div></blockquote></div><div><br></div><div>Keith<br></div><div>-- <br></div><div>Sent from my Android device with K-9 Mail. Please excuse my brevity.<br></div></div><div>_______________________________________________<br></div><div> Libraries mailing list<br></div><div> <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br></div><div> <a rel="noreferrer" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br></div></blockquote></div><div>_______________________________________________<br></div><div> Libraries mailing list<br></div><div> <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br></div><div> <a rel="noreferrer" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br></div></blockquote></div></div></blockquote></div><div>_______________________________________________<br></div><div>Libraries mailing list<br></div><div>Libraries@haskell.org<br></div><div>http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries<br></div><div><br></div></blockquote><div><br></div></body></html>