I'm trying to get more familiar with Haskell by developing web-app-ish services.
Say I'm developing a web-server and I want to keep persistent state between requests; a counter, for instance. What is the Haskell way of doing things?
I came across this discussion on my Google search. The proposed solution looks like a good example of what not to do.
One idea I had was having the request handler take in an MVar:
requestHandler :: MVar State -> IO (Maybe Response)
When registering the handler, it could be curried with an MVar created in main.
There must be a better way. I can't help but think I'm approaching this problem in a non-functional way.
Thanks!