
On Thu, 2020-08-27 at 00:01 +0200, Henning Thielemann wrote:
On Wed, 26 Aug 2020, Olaf Klinke wrote:
The Yesod book [1,2] gives examples where state is encoded in an IORef inside the foundational type, like so:
data AppState = ... data App = App {appState :: IORef AppState}
IORef sounds mighty wrong, because a web server is highly concurrent.
I agree that this is a potential data leak and security risk. That is one of the reasons why I am seeking alternatives. I experimented, and it seems when the webserver forks to serve a new client, it does not copy the other client's current IORef state. Don't know how that works. In another webserver an IORef's content persisted from one session to the next, though. So the actual internal workings are a mystery to me. Can somebody shed light on this? Olaf