I am taking some old code to upgrade it. It is a simple backend using Scotty, and I found that the server loop only consists in a call to
scotty, and all the API calls can update global mutable
IORefs. It looks like it is unsafe because there is no protection against multiple concurrent writes. I wonder what is the idiomatic way to add this kind of protection. An
atomicModifyIORef? If I wanted to use
STM with Scotty, would that be possible?
Thanks in advance.