We loved being at Scala Italy this year and we already can't wait for next year! The talks have been posted and we are excited to watch them again so if you didn't get the chance to attend then don't worry as you can catch up here. Check out this talk by Fabio Labella on Shared state in pure FP: when a state monad won’t do.
Shared state in pure FP: when a state monad won't do
A shared cache, a concurrent counter, a mutable DB connection: they are all common concerns in real-world applications that don’t fit the state monad model of returning a new copy of the state each time. Does this mean we should drop pure FP in those cases? Of course not!
This talk will show how mutable, shared, concurrent state is not only possible, but very simple in pure FP, whilst remaining composable and easy to reason about.
On one hand, we will see how to put together several concepts such as the IO type, Kleisli, and Free/Final Tagless. On the other, we’ll get at the very heart of what purity is all about.