Data.AssocList

hxt-9.3.1.22: A collection of tools for processing XML with Haskell.

Copyright | Copyright (C) 2010 Uwe Schmidt
License | MIT
Maintainer | Uwe Schmidt (uwe@fh-wedel.de)
Stability | stable
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.AssocList

Description

Simple key value assocciation list implemented as unordered list of pairs

Synopsis

- type AssocList k v = [(k, v)]
- lookupDef :: Eq k => v -> k -> AssocList k v -> v
- lookup1 :: Eq k => k -> AssocList k [e] -> [e]
- hasEntry :: Eq k => k -> AssocList k v -> Bool
- addEntry :: Eq k => k -> v -> AssocList k v -> AssocList k v
- delEntry :: Eq k => k -> AssocList k v -> AssocList k v
- addEntries :: Eq k => AssocList k v -> AssocList k v -> AssocList k v
- delEntries :: Eq k => [k] -> AssocList k v -> AssocList k v

# Documentation

type AssocList k v = [(k, v)] #

lookupDef :: Eq k => v -> k -> AssocList k v -> v #

lookup with default value

lookup1 :: Eq k => k -> AssocList k [e] -> [e] #

lookup with empty list (empty string) as default value

hasEntry :: Eq k => k -> AssocList k v -> Bool #

test for existence of a key

addEntry :: Eq k => k -> v -> AssocList k v -> AssocList k v #

add an entry, remove an existing entry before adding the new one at the top of the list, addEntry is strict

delEntry :: Eq k => k -> AssocList k v -> AssocList k v #

delete an entry, delEntry is strict

addEntries :: Eq k => AssocList k v -> AssocList k v -> AssocList k v #

add a whole list of entries with `addEntry`

delEntries :: Eq k => [k] -> AssocList k v -> AssocList k v #

delete a list of entries with `delEntry`