<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 17, 2013 at 1:37 PM, Graham Klyne <span dir="ltr">&lt;<a href="mailto:GK@ninebynine.org" target="_blank">GK@ninebynine.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":1fw">I don&#39;t want to be defensive, but I&#39;d like to know what criteria would be satisfied by &quot;a decent URI library that we can bless&quot;.<br>
</div></blockquote><div><br></div><div style>Network.URI is well-written, has a (mostly) acceptable API, and has tests, but facts on the ground have changed since you wrote this module in 2004. These days, the use of String in text-processing code is pretty close to disqualifying IMO. My criteria for a &quot;decent URI library that we can bless&quot; would be:</div>
<div style><br></div><div style>  * datatypes and primitive functions using ByteString and/or Text, with parsing and rendering functions working both on Text and on utf-8-encoded ByteStrings</div><div style><br></div><div style>
  * a faster parser. I just plugged Network.URI&#39;s parser into criterion and got a timing of 12µs to parse a 52-character URI. Switching the benchmark to use a 365-character URI causes the time to balloon to 85µs. That&#39;s looking pretty linear at roughly 4MB/s throughput. As a data point, on the same machine my work-in-progress Snap branch based on io-streams can parse a 365-byte HTTP request in 1.8µs (about 190 MB/s), and that&#39;s running through a bunch of streaming IO gunk.</div>
<div style><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":1fw">
As an implementation of RFC 3986 [1] (the current definitive specification of a URI), I believe Network.URI is fairly complete.  I&#39;m sure there are aspects that might be considered poor style, poorly implemented, lacking some useful functions, or poor API design, but nobody&#39;s really said what they are (*).  And I&#39;d suggest that all but the final one of those criteria are fixable in an existing library.</div>
</blockquote><div><br></div><div style>Fixable yes, fixed by anyone yet? no. Michael&#39;s uri-conduit has the &quot;correct&quot; types, but that library is under-documented, incomplete compared to Network.URI, and there&#39;s no way the canonical URI library should be depending on conduit.</div>
</div><br clear="all"><div>G</div>-- <br>Gregory Collins &lt;<a href="mailto:greg@gregorycollins.net" target="_blank">greg@gregorycollins.net</a>&gt;
</div></div>