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: January 2006
| Exported names: |
Functions:
allDBKeys
| cleanDB
| deleteDBEntry
| existsDBKey
| getDBInfo
| getDBInfos
| groupByIndex
| index
| newDBEntry
| sortByIndex
| updateDBEntry
| Summary of exported functions: |
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
| Imported modules: |
| Exported datatypes: |
| Exported functions: |
:: (Int -> a -> Dynamic) -> Int -> IO Bool
Exists an entry with a given key in the database?
Example call: (existsDBKey db key)
db
- the database (a dynamic predicate)
key
- a key (an integer)
:: (Int -> a -> Dynamic) -> IO [Int]
Returns all keys of entries in the database.
:: (Int -> a -> Dynamic) -> Int -> IO a
Gets the information about an entry in the database.
Example call: (getDBInfo db key)
db
- the database (a dynamic predicate)
key
- the key of the entry (an integer)
:: a -> [a] -> Int
compute the position of an entry in a list fail, if given entry is not an element.
Example call: (index x xs)
x
- the entry searched for
xs
- the list to search in
:: [(Int,a)] -> [a]
Sorts a given list by associated index .
:: [(Int,a)] -> [[a]]
Sorts a given list by associated index and group for identical index. Empty lists are added for missing indexes
:: (Int -> a -> Dynamic) -> [Int] -> IO [a]
Gets the information about a list of entries in the database.
Example call: (getDBInfos db keys)
db
- the database (a dynamic predicate)
keys
- the list of keys of the entry (integers)
:: (Int -> a -> Dynamic) -> Int -> IO ()
Deletes an entry with a given key in the database.
Example call: (deleteDBEntry db key)
db
- the database (a dynamic predicate)
key
- the key of the entry (an integer)
:: (Int -> a -> Dynamic) -> Int -> a -> IO ()
Overwrites an existing entry in the database.
Example call: (updateDBEntry db key info)
db
- the database (a dynamic predicate)
key
- the key of the entry (an integer)
info
- the information to be stored in the updated entry
:: (Int -> a -> Dynamic) -> a -> IO Int
Stores a new entry in the database and return the key of the new entry.
Example call: (newDBEntry db info)
db
- the database (a dynamic predicate)
info
- the information to be stored in the new entry
:: (Int -> a -> Dynamic) -> IO ()
Deletes all entries in the database.