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.
Documentation
putValue :: Typeable a => String -> String -> a -> IO ()Source
Put a value into the given data-store.
getValue :: Typeable a => String -> String -> IO (Maybe a)Source
Get a value from the given data-store, if it exists. If it
doesn't exist, obviously, Nothing
will be returned.