A Lamdera package. It is not on package.elm-lang.org: the Lamdera compiler provides it, from static.lamdera.com, so lamdera install works and elm install does not.
A dictionary mapping unique keys to values where insertion order is preserved for functions like foldl and toList.
Insert a key-value pair into the dictionary. Replaces value when there is a collision.
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 inserted too.
Update the value of a dictionary only if the specified key is present in the dictionary.
Remove a key-value pair from a dictionary. If the key is not found, no changes are made.
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 == NothingCheck if two dictionaries are equal regardless what order items were inserted.
Note that this is not the same as writing dict1 == dict2. Insertion order matters when using ==.
dict1 = SeqDict.fromList [ ( "A", 1 ), ( "B", 2 ) ]
dict2 = SeqDict.fromList [ ( "B", 2 ), ( "A", 1 ) ]
SeqDict.unorderedEquals dict1 dict2 -- True
dict1 == dict2 -- FalseCombine 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.
The most general way of combining two dictionaries. You provide three accumulators for when a given key appears:
You then traverse all the keys by insertion order, starting with the left dictionary and then the right dictionary (keys that appear in both are skipped for the right dictionary)
Convert a dictionary into an association list of key-value pairs.
Get all of the keys in a dictionary.
keys (fromList [(0,"Alice"),(1,"Bob")]) == [0,1]Get all of the values in a dictionary as a List.
values (fromList [(0,"Alice"),(1,"Bob")]) == ["Alice", "Bob"]Fold over the key-value pairs in a dictionary in the order the key was first inserted.
Fold over the key-value pairs in a dictionary in the reverse order the key was first inserted.
Keep a key-value pair when it satisfies a predicate.
Filter out certain key-value pairs while also mapping over the values.
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.
The Lamdera compiler relies on this function, it is not intended to be used directly. Vendor this function in your own codebase if you want to use it, as the encoding can change without notice.
The Lamdera compiler relies on this function, it is not intended to be used directly. Vendor this function in your own codebase if you want to use it, as the encoding can change without notice.
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.This implementation differs from the one in core in that keys don't have to be comparable, and that operations like foldl and foldr iterates the key-value pairs in insertion order instead of sorted order.