HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleprimitive-unlifted-2.1.0.0Haskell2010

Data.Primitive.Unlifted.Weak.Primops

Primops for weak references from (lifted or unlifted) values to unlifted values. Several of these use a slightly different interface than the underlying GHC primops. I have a GHC proposal in progress (https:/github.comghc-proposalsghc-proposalspull/367) to make GHC match this interface. Note that the GHC primops work just fine with unlifted types as keys, so we only need to fake our own to use unlifted types as values.

  • 1 type
  • 8 values
newtypenewtype UnliftedWeak# (a :: UnliftedType)
#

A weak pointer from a key (which may be lifted or unlifted) to an unlifted value.

finalizeUnliftedWeak# attempts to finalize an UnliftedWeak#. If the weak pointer is already dead, or it has no Haskell finalizer, it returns (#) | #). Otherwise, it returns (# | f #), where f is the Haskell finalization action. The return value b from the finalizer should be ignored. finalizeUnliftedWeak# breaks the connection the UnliftedWeak# has maintained between key and value and runs any C finalizers. After finalization, deRefUnliftedWeak# will return (#) | #).