<p>Interesting idea. I don't really like that StdMethod cannot encode custom methos though.</p>
<p>data Method = Std StdMethod ¦ Ext ByteString</p>
<p>Might work. But is the complexity worth it? </p>
<p><blockquote type="cite">Am 04.02.2011 09:43 schrieb "Christian Maeder" <<a href="mailto:Christian.Maeder@dfki.de">Christian.Maeder@dfki.de</a>>:<br><br>Am 03.02.2011 22:42, schrieb Aristid Breitkreuz:<br>
<p><font color="#500050">> Hi,<br>> <br>> I just wanted to announce that I uploaded a first version of http-types<br>> to hackage:<br>> <br>...</font></p>With your two types Method and MethodADT I would omit "OtherMethod" in<br>
MethodADT, since a mere enumeration type is much better:<br>
<br>
data StdMethod<br>
= GET<br>
| POST<br>
| HEAD<br>
| PUT<br>
| DELETE<br>
| TRACE<br>
| CONNECT<br>
| OPTIONS<br>
deriving (Show, Eq, Ord, Enum, Bounded)<br>
<br>
method :: StdMethod -> Method<br>
method = Ascii.pack . show<br>
<br>
methodListB :: [(Method, StdMethod)]<br>
methodListB = map (\ s -> (method s, s))<br>
[minBound .. maxBound]<br>
<br>
methodToStdMethod :: Method -> Maybe StdMethod<br>
methodToStdMethod = flip lookup methodListB<br>
<br>
Cheers Christian<br>
</blockquote></p>