A dictionary mapping unique keys to values.
Insert, remove, and query operations all take O(log n) time.
This implementation is based on
Skinney/elm-dict-exploration,
except that it uses Sorter instead of comparable, so it permits keys
that are not comparable.
Insert a key-value pair in a dictionary. Replaces value when that key is already present.
Take all the key-value pairs in the first dictionary and
insert them into the second dictionary.
Remove a key-value pair from a dictionary. If the key is not found, no changes are made.
Update the value of a dictionary for a specific key with a given function. The given function gets the current value as a parameter and its return value determines if the value is updated or removed. New key-value pairs can be stored too.
The most general way of combining two dictionaries. You provide three accumulators for when a given key appears:
You then traverse all the keys, building up whatever you want.
The given Sorter will be used to compare the keys.
Determine if a dictionary is empty. isEmpty empty == True
Determine the number of key-value pairs in the dictionary.
Get the value associated with a key. If the key is not found, return
Nothing. This is useful when you are not sure if a key will be in the
dictionary.
animals = fromList [ ("Tom", Cat), ("Jerry", Mouse) ]
get "Tom" animals == Just Cat
get "Jerry" animals == Just Mouse
get "Spike" animals == NothingReturn True if the given key is in the given dictionary.
Check if two dictionaries are equal.
Apply a function to all values in a dictionary.
Keep a key-value pair only if it satisfies a predicate.
Remove a key-value pair if it satisfies a predicate.
Fold over the key-value pairs in a dictionary, in order from lowest key to highest key.
Fold over the key-value pairs in a dictionary, in order from highest key to lowest key.
Partition a dictionary according to a predicate. The first dictionary contains all key-value pairs which satisfy the predicate, and the second contains the rest.
Get all of the keys in a dictionary, sorted from lowest to highest. keys (fromList [(0,"Alice"),(1,"Bob")]) == [0,1]
Get all of the values in a dictionary, in the order of their keys. values (fromList [(0,"Alice"),(1,"Bob")]) == ["Alice", "Bob"]
Convert a dictionary into an association list of key-value pairs, sorted by keys.
A dictionary of keys and values. So a
(Dict String User)is a dictionary that lets you look up aString(such as user names) and find the associatedUser.