Monad STis a great approach, but depending on your use case, there may or may not be standard library functions for this.
Data.StrMap purescript-maps , , , Data.StrMap.ST .
, ST FFI. . - ,
setFoo :: forall r a h eff. STRef h { foo :: a | r } -> a -> Eff (st :: ST h | eff) Unit
. . , Data.StrMap: , .