Copyright | (c) 2019-2021 Edward Kmett |
---|---|
License | BSD-2-Clause OR Apache-2.0 |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
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 IORef
s.
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.