I am trying to get a better understanding of Haskell by creating web-app-ish services.
Let's say I'm developing a web server, and I want to maintain a constant state between requests; counter, for example. What is the Haskell way of doing things?
I found this discussion in my google search. The proposed solution looks like a good example of what not to do.
One of my ideas was that the request handler accepted MVar:
requestHandler :: MVar State -> IO (Maybe Response)
When registering a handler, it can be drawn with MVar, which was created mainly.
There must be a better way. I cannot help but think that I am approaching this problem in a non-functional way.
Thanks!
David
source share