sloppiness probably. If you submit a patch that adds an instance I will apply it.<div><br></div><div>That said, I am not sure it is going to solve your particular problem.</div><div><br></div><div>simpleHTTP requires something that is an instance of ToMessage. ToMessage is a class that turns values into a Response. It happens that anything that is an instance of  Xml is also an instance of ToMessage. And to be an instance of Xml it needs to be an instance of Default. So that is where the Default requirement is coming from. Since there is no explicit ByteString instance for ToMessage, it is trying to use the general Xml instance instead. I often wish the Xml instance for ToMessage did not exist. I am not sure anyone uses it, and I might remove it someday..</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div>Ultimately what you need to do is get the value returned by Network.HTTP converted into a value of type Response. If you pass that to simpleHTTP, then everything should be fine, since Response is an instance of ToMessage.</div>
<div><br></div><div>Now, if you just want to directly echo the Response from Network.HTTP to the output socket with no munging around, then the current Response type might not be so friendly, because it expects that you are going to set the http response code, the headers, and the body separately. So, you would have to parse the bytestring into a Response just to turn it back into the the same bytestring. But if your proxying requires munging some headers anyway, then that is not a big deal. We could consider adding another constructor to the Response type that just takes a lazy bytestring that is supposed to represent a fully-formed response..</div>
<div><br></div><div>- jeremy</div><div> </div><div><br></div><div><div class="gmail_quote">On Fri, Mar 19, 2010 at 12:18 PM, Mads Lindstrøm <span dir="ltr">&lt;<a href="mailto:mads_lindstroem@yahoo.dk">mads_lindstroem@yahoo.dk</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi<br>
<br>
Why is that Happstack has:<br>
<br>
instance Happstack.Data.Default.Default Data.ByteString<br>
<br>
But not one for:<br>
<br>
instance Happstack.Data.Default.Default Data.ByteString.Lazy<br>
<br>
<br>
I am trying to make a HTTP proxy using Happstack and the client part<br>
with the Network.HTTP (see Hackage). Network.HTTP.simpleHttp returns a<br>
lazy Bytestring when given a lazy Bytestring (which makes sense).<br>
Happstack on the other hand contains a lazy ByteString in its request<br>
type:<br>
<br>
data Request = Request { ... rqHeaders :: Headers, ... rqBody ::<br>
RqBody ... }<br>
<br>
newtype RqBody = Body Data.ByteString.Lazy.Internal.ByteString<br>
<br>
which Happstack.Server.SimpleHttp.simpleHTTP feeds into my application.<br>
However Happstack.Server.SimpleHttp.simpleHTTP expects something<br>
returned which is an instance of Happstack.Data.Default.Default which<br>
lazy ByteString is not.<br>
<br>
Confused? So am I. Who thought String handling could be so complex.<br>
<br>
<br>
Greetings,<br>
<font color="#888888"><br>
Mads Lindstrøm<br>
<br>
<br>
</font><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>