[Haskell-cafe] Conduit & state

Michael Snoyman michael at snoyman.com
Sat Jul 19 22:08:33 UTC 2014

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

On Fri, Jul 18, 2014 at 4:15 PM, Павел Гаврилов <lghtfck at gmail.com> wrote:

> Hi!
> I have:
> runUnixServer (serverSettings socket) $ \appData ->
>   appSource appData
>   $$ CL.map handleBS
>   =$ appSink appData
> 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?
> Thanx, Pavel.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140720/7adb2233/attachment.html>

More information about the Haskell-Cafe mailing list