<div dir="ltr">Keep in mind that a State monad won't necessarily play nicely with a multithreaded server. In particular, each new connection will have its state set at the point the state was at when the server started, and modifications from each child thread will be discarded. (That's assuming you do something like using monad-control.) Depending on your actual needs, you may instead want to store the priority queue in some kind of a mutable variable, so that the child threads are able to update the state for other threads.<br>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jul 18, 2014 at 4:15 PM, Павел Гаврилов <span dir="ltr"><<a href="mailto:lghtfck@gmail.com" target="_blank">lghtfck@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi!<br><div><br></div><div>I have:<br></div><div><br>runUnixServer (serverSettings socket) $ \appData -><br>

  appSource appData<br>  $$ CL.map handleBS<br>  =$ appSink appData<br><br></div><div>I  want to store some data in priority queue in Monad.State and be able to access it inside the handleBS (now: handleBS :: ByteString -> ByteString). Can you send me on the right path?<br>


<br></div><div>Thanx, Pavel.<br></div><div><br></div><div><br></div></div>
<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>