foreign-store-0.0: Store a stable pointer in a foreign context to be retrieved later. Persists through GHCi reloads.

Safe HaskellSafe-Inferred

Foreign.Store

Description

Store a stable pointer in a foreign context to be retrieved later. Persists through GHCi reloads.

Synopsis

Documentation

newStore :: a -> IO (Store a)Source

Make a new store. The internal vector of stores grows in side. When stores are deleted the vector does not shrink, but old slots are re-used.

lookupStore :: Word32 -> IO (Maybe (Store a))Source

Lookup from the store.

readStore :: Store a -> IO aSource

Read from the store. If the store has been deleted, this will throw an exception.

deleteStore :: Store a -> IO ()Source

Frees the stable pointer for GC and frees up the slot in the store. Deleting an already deleted store is a no-op.

data Store a Source

A hideously unsafe store. Only for use if you are suave.

Constructors

Store Word32 

Instances

Eq (Store a) 
Show (Store a)