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.

  1. module Data.Primitive.MutVar

    Primitive boxed mutable variables. This is a generalization of Data.IORef, Data.STRef and Data.STRef.Lazy to work in any PrimMonad.

  2. data MutVar s a

    primitive Data.Primitive.MutVar

    A MutVar behaves like a single-element mutable array associated with a primitive state token.

  3. MutVar :: MutVar# s a -> MutVar s a

    primitive Data.Primitive.MutVar

    No documentation available.

  4. atomicModifyMutVar :: PrimMonad m => MutVar (PrimState m) a -> (a -> (a, b)) -> m b

    primitive 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.

  5. atomicModifyMutVar' :: PrimMonad m => MutVar (PrimState m) a -> (a -> (a, b)) -> m b

    primitive Data.Primitive.MutVar

    Strict version of atomicModifyMutVar. This forces both the value stored in the MutVar as well as the value returned.

  6. 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.

  7. modifyMutVar' :: PrimMonad m => MutVar (PrimState m) a -> (a -> a) -> m ()

    primitive Data.Primitive.MutVar

    Strict version of modifyMutVar.

  8. mutVarFromIORef :: IORef a -> MutVar RealWorld a

    primitive Data.Primitive.MutVar

    Convert MutVar to IORef

  9. mutVarFromSTRef :: STRef s a -> MutVar s a

    primitive Data.Primitive.MutVar

    Convert MutVar to STRef

  10. mutVarToIORef :: MutVar RealWorld a -> IORef a

    primitive Data.Primitive.MutVar

    Convert MutVar to IORef

Page 10 of many | Previous | Next