<div><div dir="auto">Agreed. </div></div><div dir="auto"><br></div><div dir="auto">As David and Eric both say:</div><div dir="auto">For in heap / memory size structures, it’s impossible to ever have an in ram structure that exceeds the largest positive value for Int.  And ghc is also quite good at optimizing int.  </div><div dir="auto"><br></div><div dir="auto">1) what is your application domain / context ?</div><div dir="auto"><br></div><div dir="auto">2) all of these are implementable in user space, what design / implementation experiments have you done ?</div><div dir="auto"><br></div><div dir="auto">It’s worth mentioning that RULES style optimization in this case would only run AFTER it’s been specialized to a concrete type.  And that short of lots of specialize pragmas or inlining , the generic code will thusly miss out on all sorts of unboxong etc.  </div><div><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 13, 2018 at 10:31 PM David Feuer <<a href="mailto:david.feuer@gmail.com">david.feuer@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">That won't help whatsoever in most cases. The matter has been discussed several times with no progress. If you want to add RULES for Int8, Int16, ..., Word, Word8, ..., and Natural to match the ones for Int and Integer, that would make sense, but the basic problem will remain for unmentioned types.</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 13, 2018, 10:24 PM Vanessa McHale <<a href="mailto:vanessa.mchale@iohk.io" target="_blank">vanessa.mchale@iohk.io</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div 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="m_-647329224008961661m_2827204674479436978moz-cite-prefix">On 11/13/18 9:13 PM, David Feuer wrote:<br>
    </div>
    <blockquote type="cite">
      
      <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" rel="noreferrer" target="_blank">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" rel="noreferrer noreferrer" target="_blank">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" rel="noreferrer noreferrer" target="_blank">Libraries@haskell.org</a><br>
          > <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
          _______________________________________________<br>
          Libraries mailing list<br>
          <a href="mailto:Libraries@haskell.org" rel="noreferrer noreferrer" target="_blank">Libraries@haskell.org</a><br>
          <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
        </blockquote>
      </div>
    </blockquote>
  </div>

</blockquote></div>
_______________________________________________<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>