creatur-5.9.5: Framework for artificial life experiments.

Copyright(c) Amy de Buitléir 2012-2015
LicenseBSD-style
Maintaineramy@nualeargais.ie
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell98

ALife.Creatur.Database

Description

Database interface for the Créatúr framework.

Synopsis

Documentation

class Database d where Source

A database offering storage and retrieval for records.

Associated Types

type DBRecord d Source

Methods

keys :: StateT d IO [String] Source

Get a list of all active keys in the database.

numRecords :: StateT d IO Int Source

Return the number of records stored in the database.

archivedKeys :: StateT d IO [String] Source

Get a list of all archived keys in the database. If the database does not implement archiving, it may return an empty list.

lookup :: Serialize (DBRecord d) => String -> StateT d IO (Either String (DBRecord d)) Source

Read an active record from the database.

lookupInArchive :: Serialize (DBRecord d) => String -> StateT d IO (Either String (DBRecord d)) Source

Read an archived record from the database.

store :: (Record (DBRecord d), Serialize (DBRecord d)) => DBRecord d -> StateT d IO () Source

Write a record to the database. If an agent with the same name already exists, it will be overwritten.

delete :: Serialize (DBRecord d) => String -> StateT d IO () Source

Remove a record from the database. The database may archive records rather than simply deleting them.

class Record r where Source

Methods

key :: r -> String Source

class Record r => SizedRecord r where Source

Methods

size :: r -> Int Source