-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Store a stable pointer in a foreign context to be retrieved later. Persists through GHCi reloads. -- -- Store a stable pointer in a foreign context to be retrieved later. -- Persists through GHCi reloads. @package foreign-store @version 0.1 -- | Store a stable pointer in a foreign context to be retrieved later. -- Persists through GHCi reloads. Not thread-safe. module Foreign.Store -- | Write to the store at the given index. If a store doesn't exist, -- creates one and resizes the store vector to fit. If there is already a -- store at the given index, deletes that store with deleteStore -- before replacing it. Not thread-safe. writeStore :: Store a -> a -> IO () -- | Allocates or finds an unallocated store. The index is random. The -- internal vector of stores grows in size. When stores are deleted the -- vector does not shrink, but old slots are re-used. Not thread-safe. newStore :: a -> IO (Store a) -- | Lookup from the store if an index is allocated. lookupStore :: Word32 -> IO (Maybe (Store a)) -- | Read from the store. If the store has been deleted or is unallocated, -- this will throw an exception. Not thread-safe. readStore :: Store a -> IO a -- | Frees the stable pointer for GC and frees up the slot in the store. -- Deleting an already deleted store is a no-op. Not thread-safe. deleteStore :: Store a -> IO () -- | Run the action and store the result. storeAction :: Store a -> IO a -> IO a -- | Run the action and store the result. withStore :: Store a -> (a -> IO b) -> IO b -- | A hideously unsafe store. Only for use if you are suave. data Store a Store :: Word32 -> Store a instance Typeable StoreException instance Show StoreException instance Eq StoreException instance Show (Store a) instance Eq (Store a) instance Exception StoreException