On Fri, Mar 30, 2012 at 4:36 AM, Lennart Kolmodin <span dir="ltr">&lt;<a href="mailto:kolmodin@gmail.com">kolmodin@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">Congratulations to the new release, and may I say that the homepage looks smashing! :D</div></div></blockquote><div><br></div><div>Thanks!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Before I saw happstack-wai I had a quick look at the happstack API and saw that the Request keeps the request body as a (lazy?) String. </div></blockquote><div><br></div><div>Hmm. I am not sure what you are referring to. </div>
<div><br></div><div>Looking a the Request type:</div><div><br></div><div><a href="http://www.happstack.com/docs/happstack-server-7.0.0/doc/html/happstack-server/Happstack-Server-Types.html#t:Request">http://www.happstack.com/docs/happstack-server-7.0.0/doc/html/happstack-server/Happstack-Server-Types.html#t:Request</a></div>
<div><br></div><div>we see that the rqBody as the type:</div><div><br></div><div>    rqBody :: MVar RqBody</div><div><br></div><div>and RqBody is defined as:</div><div><br></div><div>newtype RqBody = Body { unBody :: L.ByteString } deriving (Read,Show,Typeable)</div>
<div><br></div><div>So, it is, as you would expect, a lazy ByteString. RqData is defined as a ByteString in HAppS as well.. so it is always been that way in Happstack. </div><div><br></div><div>The MVar is there so that you can process the request body as it streams over the network and have it garbage collected as you go. For example, when saving a file upload to disk, the whole file does not get sucked into RAM.</div>
<div><br></div><div>There are other places in happstack-server where we use String instead of ByteString or Text. That is mostly because happstack was started back in 2004. So, I am pretty sure it predates the existence of ByteString, and it is definitely older than Text. </div>
<div><br></div><div>Most places that should be a ByteString have been updated. Not all places that could be Text are yet. We will see more modernization in that area in Happstack 8. </div><div><br></div><div>- jeremy</div>
</div>