<div dir="ltr"><div>Wow. DeepSeq is cool!</div><div>I 'deepseq'ed received request header and everything is OK.<br></div><div><br></div><div>Thanks Santtu!</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">

2014-07-24 16:53 GMT+09:00 Santtu Keskinen <span dir="ltr"><<a href="mailto:laquendi@gmail.com" target="_blank">laquendi@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">Hi Chul-Woong,<br><br>Deepseq package can be used to make sure a list is actually fully constructed before it's used.<br><br>import System.IO<br>import Control.DeepSeq<div class=""><br>main :: IO ()<br>

main = do<br></div>    s <- getContents <br>
    s `deepseq` hClose stdin<br>    putStrLn "ECHO result"<br>    putStr s<br><br>Cheers<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-24 9:07 GMT+03:00 양철웅 <span dir="ltr"><<a href="mailto:cwyang@aranetworks.com" target="_blank">cwyang@aranetworks.com</a>></span>:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Hi, all.</div><div><br></div><div>Haskell's lazy IO causes below program to </div>

<div>write back "ECHO result" to the user </div>
<div>even if he doesn't give any input to the program.</div>

<div><br></div><div>test1 :: IO ()</div><div>test1 = do</div><div>  l <- fmap lines getContents</div><div>  putStrLn "ECHO result"</div><div>  putStr $ unlines l</div><div><br></div><div>If the client logic, that is the part for feeding data to this program</div>




<div>and wait for the response, expect the server logic to respond</div><div>only after all the client's request data are feed to the server logic,</div><div>the behaviour could be problematic.</div><div><br></div><div>




I'm now writing simple web server, as you might guess, and</div><div>my web server responds "HTTP/1.1" before any client's request</div><div>are given. I'm using hGetContents and web server's logic is</div>




<div>basically same with above code skeleton.</div><div><br></div><div>How can I tell the program to respond data only after all the</div><div>requests are feed? Any directions are welcomed.</div><div>Thanks.</div><div><br>




</div><div>Chul-Woong</div><div><br></div></div>
<br></div></div><div class="">_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></div></blockquote></div><br></div>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>