Relude already offers lifted versions of atomicModifyIORef and atomicModifyIORef' functions. But these functions often used with () in the second place of tuple. See example in hintman:
The new functions were proposed to be added to base but they haven't landed:
I propose to implement them by ourselves. And if they ever going to be implemented in base, we can easily reexport them.
The type signatures:
atomicModifyIORef_ :: MonadIO m => IORef a -> (a -> a) -> m ()
atomicModifyIORef'_ :: MonadIO m => IORef a -> (a -> a) -> m ()
Relude already offers lifted versions of
atomicModifyIORefandatomicModifyIORef'functions. But these functions often used with()in the second place of tuple. See example inhintman:The new functions were proposed to be added to
basebut they haven't landed:I propose to implement them by ourselves. And if they ever going to be implemented in
base, we can easily reexport them.The type signatures: