This module provides a general interface for databases (persistent predicates) where each entry consists of a key and an info part. The key is an integer and the info is arbitrary. All functions are parameterized with a dynamic predicate that takes an integer key as a first parameter.
Author: Bernd Brassel, Michael Hanus
Version: August 2011
existsDBKey
:: (Int -> a -> Dynamic) -> Int -> Query Bool
Exists an entry with a given key in the database? |
allDBKeys
:: (Int -> a -> Dynamic) -> Query [Int]
Query that returns all keys of entries in the database. |
allDBInfos
:: (Int -> a -> Dynamic) -> Query [a]
Query that returns all infos of entries in the database. |
allDBKeyInfos
:: (Int -> a -> Dynamic) -> Query [(Int,a)]
Query that returns all key/info pairs of the database. |
getDBInfo
:: (Int -> a -> Dynamic) -> Int -> Query (Maybe a)
Gets the information about an entry in the database. |
index
:: a -> [a] -> Int
compute the position of an entry in a list fail, if given entry is not an element. |
sortByIndex
:: [(Int,a)] -> [a]
Sorts a given list by associated index . |
groupByIndex
:: [(Int,a)] -> [[a]]
Sorts a given list by associated index and group for identical index. |
getDBInfos
:: (Int -> a -> Dynamic) -> [Int] -> Query (Maybe [a])
Gets the information about a list of entries in the database. |
deleteDBEntry
:: (Int -> a -> Dynamic) -> Int -> Transaction ()
Deletes an entry with a given key in the database. |
deleteDBEntries
:: (Int -> a -> Dynamic) -> [Int] -> Transaction ()
Deletes all entries with the given keys in the database. |
updateDBEntry
:: (Int -> a -> Dynamic) -> Int -> a -> Transaction ()
Overwrites an existing entry in the database. |
newDBEntry
:: (Int -> a -> Dynamic) -> a -> Transaction Int
Stores a new entry in the database and return the key of the new entry. |
newDBKeyEntry
:: (Int -> a -> Dynamic) -> Int -> a -> Transaction ()
Stores a new entry in the database under a given key. |
cleanDB
:: (Int -> a -> Dynamic) -> Transaction ()
Deletes all entries in the database. |
Exists an entry with a given key in the database?
|
Query that returns all keys of entries in the database. |
Query that returns all infos of entries in the database. |
Query that returns all key/info pairs of the database. |
Gets the information about an entry in the database.
|
compute the position of an entry in a list fail, if given entry is not an element.
|
Sorts a given list by associated index . |
Sorts a given list by associated index and group for identical index. Empty lists are added for missing indexes |
Gets the information about a list of entries in the database.
|
Deletes an entry with a given key in the database. No error is raised if the given key does not exist.
|
Deletes all entries with the given keys in the database. No error is raised if some of the given keys does not exist.
|
Overwrites an existing entry in the database.
|
Stores a new entry in the database and return the key of the new entry.
|
Stores a new entry in the database under a given key. The transaction fails if the key already exists.
|
Deletes all entries in the database. |