Hoogle Search
Within LTS Haskell 24.4 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
-
Primitive boxed mutable variables. This is a generalization of Data.IORef, Data.STRef and Data.STRef.Lazy to work in any PrimMonad.
-
primitive Data.Primitive.MutVar A MutVar behaves like a single-element mutable array associated with a primitive state token.
MutVar :: MutVar# s a -> MutVar s aprimitive Data.Primitive.MutVar No documentation available.
atomicModifyMutVar :: PrimMonad m => MutVar (PrimState m) a -> (a -> (a, b)) -> m bprimitive Data.Primitive.MutVar Atomically mutate the contents of a MutVar. This function is useful for using MutVar in a safe way in a multithreaded program. If you only have one MutVar, then using atomicModifyMutVar to access and modify it will prevent race conditions. Extending the atomicity to multiple MutVars is problematic, so if you need to do anything more complicated, using MVar instead is a good idea. atomicModifyMutVar does not apply the function strictly. This means if a program calls atomicModifyMutVar many times, but seldom uses the value, thunks will pile up in memory resulting in a space leak. To avoid this problem, use atomicModifyMutVar' instead.
atomicModifyMutVar' :: PrimMonad m => MutVar (PrimState m) a -> (a -> (a, b)) -> m bprimitive Data.Primitive.MutVar Strict version of atomicModifyMutVar. This forces both the value stored in the MutVar as well as the value returned.
modifyMutVar :: PrimMonad m => MutVar (PrimState m) a -> (a -> a) -> m ()primitive Data.Primitive.MutVar Mutate the contents of a MutVar. modifyMutVar does not apply the function strictly. This means if a program calls modifyMutVar many times, but seldom uses the value, thunks will pile up in memory resulting in a space leak. To avoid this problem, use modifyMutVar' instead.
modifyMutVar' :: PrimMonad m => MutVar (PrimState m) a -> (a -> a) -> m ()primitive Data.Primitive.MutVar Strict version of modifyMutVar.
mutVarFromIORef :: IORef a -> MutVar RealWorld aprimitive Data.Primitive.MutVar mutVarFromSTRef :: STRef s a -> MutVar s aprimitive Data.Primitive.MutVar mutVarToIORef :: MutVar RealWorld a -> IORef aprimitive Data.Primitive.MutVar