HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulerebase-1.21.2Haskell2010

Rebase.GHC.Stable

  • 1 type
  • 5 values
  • Packagerebase-1.21.2
  • Exports6
  • LanguageHaskell2010
  • LicenceMIT
  • SourceStable.hs
datadata StablePtr a
#

A stable pointer is a reference to a Haskell expression that is guaranteed not to be affected by garbage collection, i.e., it will neither be deallocated nor will the value of the stable pointer itself change during garbage collection (ordinary references may be relocated during garbage collection). Consequently, stable pointers can be passed to foreign code, which can treat it as an opaque reference to a Haskell value.

The StablePtr 0 is reserved for representing NULL in foreign code.

A value of type StablePtr a is a stable pointer to a Haskell expression of type a.

Constructors

Instances6IArray, Eq, Storable, Prim, MArray
valuecastStablePtrToPtr :: StablePtr a -> Ptr ()
#

Coerce a stable pointer to an address. No guarantees are made about the resulting value, except that the original stable pointer can be recovered by castPtrToStablePtr. In particular, the address might not refer to an accessible memory location and any attempt to pass it to the member functions of the class Storable leads to undefined behaviour.