<div><div dir="auto">The problem is that some implementations will silently truncate data, and while the original reason for the interface was desugaring list notation to a different data structure, it’s now used for other things. </div></div><div dir="auto"><br></div><div dir="auto">Frankly, the main performance win was meant to be with respect to single round of data structure allocation/ associated fragmentation. For a statically known list. </div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, May 17, 2020 at 7:45 AM Andreas Abel <<a href="mailto:andreas.abel@ifi.lmu.de">andreas.abel@ifi.lmu.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">A question would be how to validate the given length without performance <br>
penalty. The existence of fromListN in addition to fromList is **only** <br>
justified by performance consideration, namely that the length of the <br>
list is known and does not have to be computed.<br>
<br>
In general, it seems that the given length has to be trusted, however, <br>
there might be implementations that can validate the length parameter <br>
as-you-go without additional cost (in the good case that the length is <br>
correctly given).<br>
<br>
On 2020-05-15 21:37, Carter Schonwald wrote:<br>
> validating would *prevent inconsistent data*.<br>
> <br>
> it is precisely the issue that current semantics are *not* consistent <br>
> across that needs to be addressed!<br>
> <br>
> On Thu, May 14, 2020 at 6:38 PM Joseph C. Sible <<a href="mailto:josephcsible@gmail.com" target="_blank">josephcsible@gmail.com</a> <br>
> <mailto:<a href="mailto:josephcsible@gmail.com" target="_blank">josephcsible@gmail.com</a>>> wrote:<br>
> <br>
> On Thu, May 14, 2020 at 10:41 AM Carter Schonwald<br>
> <<a href="mailto:carter.schonwald@gmail.com" target="_blank">carter.schonwald@gmail.com</a> <mailto:<a href="mailto:carter.schonwald@gmail.com" target="_blank">carter.schonwald@gmail.com</a>>> wrote:<br>
> > My inclination is we change the semantics of fromListN to be<br>
> strictly validating with an error when the length is wrong. This is<br>
> the most consistent and humane of options.<br>
> <br>
> I disagree that validating would be consistent. Look how common the<br>
> phrases "the precondition is not checked" and "violation of this<br>
> condition is not detected" are in the containers library and so many<br>
> others on Hackage.<br>
> <br>
> Joseph C. Sible<br>
> <br>
> <br>
> _______________________________________________<br>
> Libraries mailing list<br>
> <a href="mailto:Libraries@haskell.org" target="_blank">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-bin/mailman/listinfo/libraries</a><br>
> <br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">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-bin/mailman/listinfo/libraries</a><br>
</blockquote></div></div>