hmt-0.20: Haskell Music Theory
Safe HaskellSafe-Inferred
LanguageHaskell2010

Music.Theory.Db.Common

Description

Database as [[(key,value)]]

Synopsis

Type

type Entry k v = (k, v) Source #

type Record k v = [Entry k v] Source #

type Db k v = [Record k v] Source #

Record

record_key_seq :: Record k v -> [k] Source #

The sequence of keys at Record.

record_has_key :: Eq k => k -> Record k v -> Bool Source #

True if Key is present in Entity.

record_has_duplicate_keys :: Ord k => Record k v -> Bool Source #

Duplicate keys predicate.

record_lookup_by :: (k -> k -> Bool) -> k -> Record k v -> [v] Source #

Find all associations for key using given equality function.

record_lookup :: Eq k => k -> Record k v -> [v] Source #

record_lookup_at :: Eq k => (k, Int) -> Record k v -> Maybe v Source #

nth element of record_lookup.

record_lookup_uniq :: Eq k => k -> Record k v -> Maybe v Source #

Variant of record_lookup requiring a unique key. Nothing indicates there is no entry, it is an error if duplicate keys are present.

record_has_key_uniq :: Eq k => k -> Record k v -> Bool Source #

True if key exists and is unique.

record_lookup_uniq_err :: Eq k => k -> Record k v -> v Source #

Error variant.

record_lookup_uniq_def :: Eq k => v -> k -> Record k v -> v Source #

Default value variant.

record_delete_by :: (k -> k -> Bool) -> k -> Record k v -> Record k v Source #

Remove all associations for key using given equality function.

Db

db_key_set :: Ord k => Db k v -> [k] Source #

Preserves order of occurence.

db_lookup_by :: (k -> k -> Bool) -> (v -> v -> Bool) -> k -> v -> Db k v -> [Record k v] Source #

db_lookup :: (Eq k, Eq v) => k -> v -> Db k v -> [Record k v] Source #

db_key_histogram :: Ord k => Db k v -> [(k, Int)] Source #

db_to_table :: Ord k => (Maybe v -> e) -> Db k v -> ([k], [[e]]) Source #

Collating duplicate keys.

record_collate_from :: Eq k => (k, [v]) -> Record k v -> Record k [v] Source #

record_collate :: Eq k => Record k v -> Record k [v] Source #

Collate adjacent entries of existing sequence with equal key.