A dictionary mapping unique keys to values. This dictionary can use any type as a key. In the core-provided Dict, keys can only be comparable.
This little dictionary is hacky. It uses a custom toString as a hashing function - so don't use it on any types which have non-unique representations in strings! At the moment, it has custom support for converting functions into keys.
It's hard to imagine many cases where you would want a function as a key, but it's now possible.
Insert, remove, and query operations all take O(log n) time. EveryDictionary
equality with (==) is unreliable and should not be used.
Create an empty dictionary
Create a dictionary with one key-value pair.
Insert a key-value pair into a dictionary. Replaces value when there is a collision.
Update the value of a dictionary for a specific key with a given function.
Remove a key-value pair from a dictionary. If the key is not found, no changes are made.
Determine if a dictionary is empty.
isEmpty empty == TrueDetermine if a key is in a 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 "Mouse" animals == Just Mouse
get "Spike" animals == NothingGet the number of key-value pairs in a dict
Element equality
Combine two dictionaries. If there is a collision, preference is given to the first dictionary.
Keep a key-value pair when its key appears in the second dictionary. Preference is given to values in the first dictionary.
Keep a key-value pair when its key does not appear in the second dictionary.
Get all of the keys in a dictionary.
Get all of the values in a dictionary.
Convert a dictionary into an association list of key-value pairs.
Convert an association list into a dictionary. Takes a default value, and a list of key-pair tuples
Apply a function to all values in a dictionary.
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.
Keep a key-value pair when it satisfies a predicate.
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.
A dict which works with any type which lifts the type from Core's Dict