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.