Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

STM containers does it right.

  lookup :: k -> Map K v -> STM (Maybe v)

  insert :: v -> k -> Map K v -> STM ()
It won't execute until you wrap it with atomically, so you're forced to be explicit about whether these things should happen in one logical step or separately.

https://hackage-content.haskell.org/package/stm-containers/d...





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: