~/talk

Shared State In Pure Fp When A State Monad Won't Do

Talkat Scala Italy 2018 · 2018-09-14..09-15· [functional-programming]
slides:none on file

State monad is sequential and fails for concurrent servers; use effectful primitives instead. Shows a concrete Ref[F,A] implemented with java.util.concurrent.AtomicReference inside IO, exposing get/set/update/modify and a CAS retry loop that is lock‑free and guarantees progress. Recipe: suspend creation/access/modification in IO (return F[Ref[F,A]]), or wrap mutable resources with Sync/Resource. Result: sharing becomes syntactic — regions of sharing = call graph — enabling compositional, testable concurrent state.

AI-written summary · about

  1. 0:00Introduction to talk
  2. 1:06What is pure functional programming
  3. 4:55Why referential transparency matters
  4. 7:01Understanding State and its limits
  5. 8:30State monad explained
  6. 13:23State monad in practice
  7. 16:31Why State monad won’t suffice
  8. 19:22Using IO for shared state
  9. 20:30Implementing a Ref primitive
  10. 27:11Using Ref in programs
  11. 30:40Sharing and isolating state
  12. 32:25Key property of shared state
  13. 33:26Final tagless algebras
  14. 36:58Summary and conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.