<div class="gmail_quote">2011/2/3 Christian Maeder <span dir="ltr">&lt;<a href="mailto:Christian.Maeder@dfki.de">Christian.Maeder@dfki.de</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Am 02.02.2011 22:34, schrieb Aristid Breitkreuz:<br>
<div class="im">&gt; This is not a problem because constructing OtherMethod &quot;POST&quot; is<br>
&gt; forbidden and will/must never happen. byteStringToMethod will always<br>
&gt; construct POST, and not OtherMethod &quot;POST&quot;,<br>
<br>
</div>My own conclusion is: avoid as many variants as possible, otherwise<br>
you&#39;ll get lots of repetitions of similar code. A single variant<br>
wrapping a String or ByteString is the best for uniform treatment (i.e.<br>
just for implementing show).<br></blockquote><div><br></div><div>I don&#39;t see how it follows that there will be lots of repetitions of similar code. Please explain why you think this occurs, and why it is presumably hard to avoid.</div>

<div><br></div><div>In my, possibly naïve, view, you only need to implement methodToByteString once, and methodToString can be implemented as B8.unpack . methodToByteString.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">


You loose (possibly faster and shorter) pattern matching, but I think it<br>
is just as good to use predefined constants and &quot;==&quot; for comparisons.<br></blockquote><div><br></div><div>With my Method type you also get case-insensitivity for free. :-) And it removes the temptation of just writing &quot;PUT&quot; instead of, say, HTTP.methodPut. (You can get non-standard methods with byteStringToMethod, which is a total function.)</div>

<div><br></div><div>Aristid</div></div>