weak-0: Weak pointer extas
Copyright(c) 2019-2021 Edward Kmett
LicenseBSD-2-Clause OR Apache-2.0
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

System.Mem.Weak.IORef

Description

 
Synopsis

Documentation

mkWeakIORef' :: IORef k -> v -> Maybe (IO ()) -> IO (Weak v) Source #

Make an arbitrary Weak reference from a IORef.

Provides a more general API than the crippled one offered by mkWeakIORef to match the power of mkWeak.

mkWeakIORefPtr :: IORef k -> Maybe (IO ()) -> IO (Weak (IORef k)) Source #

Functions like mkWeakPtr but for IORefs.

Make an arbitrary Weak reference from an IORef and an optional finalizer.

A specialised version of mkWeakIORef' where the key and value are the same.

mkWeakIORefPair :: IORef k -> v -> Maybe (IO ()) -> IO (Weak (IORef k, v)) Source #

A specialised version of mkWeakIORef' where the value is actually a pair of the key and value passed to mkWeakIORefPair:

mkWeakIORefPair key val finalizer ≡ mkWeakIORef' key (key,val) finalizer

The advantage of this is that the key can be retrieved by deRefWeak in addition to the value.