|Maintainer||John Goerzen <firstname.lastname@example.org>|
Written by John Goerzen, email@example.com
This module provides a generic infrastructure for supporting storage of hash-like items with String -> String mappings. It can be used for in-memory or on-disk items.
- class AnyDBM a where
- closeA :: a -> IO ()
- flushA :: a -> IO ()
- insertA :: a -> String -> String -> IO ()
- deleteA :: a -> String -> IO ()
- hasKeyA :: a -> String -> IO Bool
- lookupA :: a -> String -> IO (Maybe String)
- forceLookupA :: a -> String -> IO String
- insertListA :: a -> [(String, String)] -> IO ()
- toListA :: a -> IO [(String, String)]
- keysA :: a -> IO [String]
- valuesA :: a -> IO [String]
- mapA :: AnyDBM a => a -> ((String, String) -> IO b) -> IO [b]
- strFromA :: AnyDBM a => a -> IO String
- strToA :: AnyDBM a => a -> String -> IO ()
The AnyDBM class
The main class for items implementing this interface.
People implementing this class should provide methods for:
Close the object, writing out any unsaved data to disk if necessary.
If you implement this, make sure your implementation calls
Note: if you have an object opened for writing, you MUST call closeA on it when you are done. Implementations are not required to preserve your data otherwise.
Flush the object, saving any un-saved data to disk but not closing
it. Called automatically by
Insert the given data into the map. Existing data with the same key will be overwritten.
Delete the data referenced by the given key. It is not an error if the key does not exist.
True if the given key is present.
Find the data referenced by the given key.
Look up the data and raise an exception if the key does not exist. The exception raised is PatternMatchFail, and the string accompanying it is the key that was looked up.
insertA on each pair in the given association list, adding
them to the map.
Return a representation of the content of the map as a list.
Returns a list of keys in the
Returns a list of values in the
Similar to MapM, but for
strFromAL -- get a string representation of
the entire AnyDBM.