-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | A key-value store in the IO monad.
--   
--   This library allows an application to extend the 'global state' hidden
--   inside the IO monad with semi-arbitrary data. Data is required to be
--   Typeable. The library provides an essentially unbounded number
--   of key-value stores indexed by strings, with each key within the
--   stores also being a string.
@package io-storage
@version 0.3

-- | Conceptually, this library provides a way to arbitrarily extend the
--   global state represented by the IO monad. Viewed another way, this
--   library provides a basic facility for setting and retrieving values
--   from global variables.
--   
--   The interface takes the form of a very basic key-value store, with
--   multiple different stores made available through the withStore
--   function. Stores are referenced by arbitrary strings, and keys within
--   those stores are treated likewise. The putValue,
--   getValue, and delValue functions allow you to store,
--   retrieve, and delete data from the store.
--   
--   Internally, data is stored within an IORef which is created using the
--   'unsafePerformIO hack', but this is hidden within the library so that
--   it can easily be modified if and when a more proper solution
--   is implemented.
module System.IO.Storage

-- | Create a named key-value store, and then execute the given IO action
--   within its extent. Calls to withStore can be nested, and
--   calling it again with the name of a data-store that has already been
--   initialized will cause the original to be shadowed for the duration of
--   the call to withStore.
withStore :: String -> IO a -> IO a

-- | Put a value into the given data-store.
putValue :: Typeable a => String -> String -> a -> IO ()

-- | Get a value from the given data-store, if it exists. If it doesn't
--   exist, obviously, Nothing will be returned.
getValue :: Typeable a => String -> String -> IO (Maybe a)

-- | Get a value from the given store, with a default if it doesn't exist.
getDefaultValue :: Typeable a => String -> String -> a -> IO a

-- | Delete a value from the given data-store.
delValue :: String -> String -> IO ()
