This is not a problem because constructing OtherMethod &quot;POST&quot; is forbidden and will/must never happen. byteStringToMethod will always construct POST, and not OtherMethod &quot;POST&quot;,<div><br><br><div class="gmail_quote">

2011/2/2 Michael Snoyman <span dir="ltr">&lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Originally WAI *did* use an ADT. However, someone (I *think* Jeremy<br>
Shaw, I&#39;m not sure) pointed out that pattern matching is in fact<br>
broken here:<br>
<br>
case OtherMethod POST of<br>
    POST -&gt; putStrLn &quot;Will not get called&quot;<br>
<br>
Also, with your implementation<br>
<br>
POST /= OtherMethod &quot;POST&quot;<br>
<br>
Michael<br>
<br>
On Wed, Feb 2, 2011 at 11:12 PM, Aristid Breitkreuz<br>
<div><div></div><div class="h5">&lt;<a href="mailto:aristidb@googlemail.com">aristidb@googlemail.com</a>&gt; wrote:<br>
&gt; You essentially forced me to do this. ;-)<br>
&gt; So here it is, my initial version of<br>
&gt; http-types: <a href="https://github.com/aristidb/http-types" target="_blank">https://github.com/aristidb/http-types</a><br>
&gt; Only Method is supported for now.<br>
&gt; I deliberately chose to make it an ADT for type safety reasons. This is to<br>
&gt; enable developers to write case x of POST -&gt; ..., and the compiler will find<br>
&gt; if they accidentally typed POSTX. However, non-standard methods are also<br>
&gt; supported via OtherMethod.<br>
&gt; Please take it apart and criticize! :-)<br>
&gt; If you have implementation ideas, just fork it, or I can add you as a<br>
&gt; contributor.<br>
&gt;<br>
&gt; Aristid<br>
&gt;<br>
&gt; 2011/2/2 Michael Snoyman &lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt; I think there&#39;s general consensus that this package would be a Good<br>
&gt;&gt; Thing(tm), and at the least you&#39;ll have my support on it. I&#39;m sure we<br>
&gt;&gt; can all quibble on details later, but I think the best thing now would<br>
&gt;&gt; be to have some actual code to look at.<br>
&gt;&gt;<br>
&gt;&gt; Aristid, I&#39;m assuming (hoping) you were volunteering to actually write<br>
&gt;&gt; and maintain this package, is that correct? I would recommend you get<br>
&gt;&gt; a project started (Github, BitBucket, PatchTag, wherever), getting up<br>
&gt;&gt; some code and then we can all nit-pick it to death ;).<br>
&gt;&gt;<br>
&gt;&gt; Michael<br>
&gt;&gt;<br>
&gt;&gt; On Wed, Feb 2, 2011 at 3:45 PM, Aristid Breitkreuz<br>
&gt;&gt; &lt;<a href="mailto:aristidb@googlemail.com">aristidb@googlemail.com</a>&gt; wrote:<br>
&gt;&gt; &gt; http-enumerator could at least for compatibility support a Request type<br>
&gt;&gt; &gt; with<br>
&gt;&gt; &gt; ByteString. And also a native request type. Or something along these<br>
&gt;&gt; &gt; lines.<br>
&gt;&gt; &gt; The problem is that I want to be able to use a Request type that is<br>
&gt;&gt; &gt; compatible between multiple client libraries, enabling me to<br>
&gt;&gt; &gt; theoretically<br>
&gt;&gt; &gt; switch implementations without a huge amount of hassle.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Aristid<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; 2011/2/2 Michael Snoyman &lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On Wed, Feb 2, 2011 at 2:50 PM, Aristid Breitkreuz<br>
&gt;&gt; &gt;&gt; &lt;<a href="mailto:aristidb@googlemail.com">aristidb@googlemail.com</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt; I agree with most things.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; 2011/2/2 Michael Snoyman &lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; * Request and response datatypes themselves. I don&#39;t think this<br>
&gt;&gt; &gt;&gt; &gt;&gt; makes<br>
&gt;&gt; &gt;&gt; &gt;&gt; sense to put in http-types: just between WAI and http-enumerator I<br>
&gt;&gt; &gt;&gt; &gt;&gt; needed different versions of these.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; I think this is where we could derive most value, and it would be<br>
&gt;&gt; &gt;&gt; &gt; good<br>
&gt;&gt; &gt;&gt; &gt; to<br>
&gt;&gt; &gt;&gt; &gt; find a way to do it.<br>
&gt;&gt; &gt;&gt; &gt; Request actually looks pretty similar in WAI as in http-enumerator,<br>
&gt;&gt; &gt;&gt; &gt; but<br>
&gt;&gt; &gt;&gt; &gt; Response is different. Maybe distinguish between client and server<br>
&gt;&gt; &gt;&gt; &gt; versions<br>
&gt;&gt; &gt;&gt; &gt; of Response?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; I&#39;d be very surprised if those two can be meaningfully unified. What<br>
&gt;&gt; &gt;&gt; do you do about remoteHost and errorHandler? Also, it&#39;s more useful to<br>
&gt;&gt; &gt;&gt; have the request body for http-enumerator be an Enumerator of<br>
&gt;&gt; &gt;&gt; Builders, as opposed to WAI where we want an Enumerator of<br>
&gt;&gt; &gt;&gt; ByteStrings.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; I have no opposition to *having* a Request type in http-types (or<br>
&gt;&gt; &gt;&gt; whatever we call it), but I doubt anyone will actually use it, and I<br>
&gt;&gt; &gt;&gt; wouldn&#39;t even want it to include Builder due to the extra dependency.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Michael<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br></div>