<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>This is perhaps not the right place, but if there are benchmarks
proving that genericLength is slower than it should be, it should
be easy to add a <tt>SPECIALIZE</tt> pragma. <br>
</p>
<div class="moz-cite-prefix">On 11/13/18 9:13 PM, David Feuer wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAMgWh9vO-wmK6gAbceTKR2gUnYjdM+0Wmp5a562zUY=U9b1iDw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="auto">genericLength is extremely inefficient for typical
numeric types. Int is a rather sad type for these things; it
really should be Word. But that may not be worth fixing.</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Tue, Nov 13, 2018, 9:51 PM Evan Laforge <<a
href="mailto:qdunkan@gmail.com" moz-do-not-send="true">qdunkan@gmail.com</a>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">You can
already get these as Data.List.genericLength and<br>
Data.List.genericReplicate<br>
<br>
As for changing the prelude ones, this would probably cause a
lot of<br>
busywork. Where I work we compile with -Werror and
-Wtype-defaults,<br>
so a lot of places might have to get type annotations.<br>
On Tue, Nov 13, 2018 at 5:19 PM Vanessa McHale <<a
href="mailto:vanessa.mchale@iohk.io" target="_blank"
rel="noreferrer" moz-do-not-send="true">vanessa.mchale@iohk.io</a>>
wrote:<br>
><br>
> Would it be possible to generalize replicate and length
to have type<br>
> signatures<br>
><br>
> replicate :: Integral a => a -> b -> [b]<br>
><br>
> and<br>
><br>
> length :: (Integral a, Foldable t) => t b -> a<br>
><br>
> ?<br>
><br>
> There have been a few instances where such a thing would
have been<br>
> useful to me.<br>
><br>
> Cheers<br>
><br>
><br>
> _______________________________________________<br>
> Libraries mailing list<br>
> <a href="mailto:Libraries@haskell.org" target="_blank"
rel="noreferrer" moz-do-not-send="true">Libraries@haskell.org</a><br>
> <a
href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries"
rel="noreferrer noreferrer" target="_blank"
moz-do-not-send="true">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank"
rel="noreferrer" moz-do-not-send="true">Libraries@haskell.org</a><br>
<a
href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries"
rel="noreferrer noreferrer" target="_blank"
moz-do-not-send="true">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote>
</div>
</blockquote>
</body>
</html>