HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

  • Packagepvar-1.0.0.0
  • Exports26
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceInternal.hs

Creation

valuerawStorablePVar :: (MonadPrim s m, Storable a) => m (PVar a s)

Create a mutable variable in pinned uninitialized memory using Storable interface for getting the number of bytes for memory allocation.

Access

Conversion

valuetoPtrPVar :: PVar a s -> Maybe (Ptr a)

Extract the address to the mutable variable, but only if it is backed by pinned memory. It is unsafe because even for pinned memory memory can be deallocated if associated PVar goes out of scope. Use withPtrPVar or Data.Primitive.PVar.toForeignPtr instead.

Reset

Unpacked opartions

ByteArray

Atomic operations

Memory copying

Check if memory is pinned

Check whether or not the ByteArray is pinned.

Note - This function uses GHC built-in functions for GHC 8.2 and newer, but for older versions it fallsback onto custom implementation.

Primitive versions

Helpers