<div dir="ltr">a simpler subproblem is theres no Bystring.*.Unsafe.Internal module that lets Bytestring library clients to (at their own risk) add new fusion rules.<div><br></div><div>Isn&#39;t this &quot;private fusion framework&quot; shenanigans where lib clients can&#39;t add new things that fuse well a recurrent problem making it difficult to have down stream users have their own performant extensions?</div>


</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Sep 1, 2013 at 3:42 PM, Artyom Kazak <span dir="ltr">&lt;<a href="mailto:yom@artyom.me" target="_blank">yom@artyom.me</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5">On Sun, 01 Sep 2013 23:27:20 +0400, Henning Thielemann &lt;<a href="mailto:lemming@henning-thielemann.de" target="_blank">lemming@henning-thielemann.de</a><u></u>&gt; wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On Sun, 1 Sep 2013, Artyom Kazak wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sun, 01 Sep 2013 22:55:10 +0400, Henning Thielemann &lt;<a href="mailto:lemming@henning-thielemann.de" target="_blank">lemming@henning-thielemann.de</a><u></u>&gt; wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
A possible solution might be fusion rules for ByteString.unpack and mapM_.<br>
</blockquote>
<br>
Except that such rules would require a hand-written version of mapM_ anyway.<br>
<br>
I agree that it can be written, it’s just that I don’t see why it should be<br>
in some obscure place instead of Data.ByteString.<br>
</blockquote>
<br>
This rule should of course be part of Data.ByteString. RULES are similar<br>
to class instances and like orphan instances, orphan rules are a bad idea.<br>
</blockquote>
<br></div></div>
It still doesn’t solve the problem quite like adding mapM_ does. Rules aren’t documented anywhere; why would the programmer expect `mapM_ . unpack` to fuse?<br>
<br>
Moreover, it violates the existing structure of bytestring package. For instance, functions like `last` and `maximum` could be implemented as rules in the same way, but they’re included in Data.ByteString (for good, I’d say).<div class="HOEnZb">

<div class="h5"><br>
<br>
______________________________<u></u>_________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/libraries</a><br>
</div></div></blockquote></div><br></div>