# Alternative f => [f a] -> f a -quickcheck +containers

The union of a list of maps.
> unions [(fromList [(5, "a"), (3, "b")]), (fromList [(5, "A"), (7, "C")]), (fromList [(5, "A3"), (3, "B3")])]
> == fromList [(3, "b"), (5, "a"), (7, "C")]
> unions [(fromList [(5, "A3"), (3, "B3")]), (fromList [(5, "A"), (7, "C")]), (fromList [(5, "a"), (3, "b")])]
> == fromList [(3, "B3"), (5, "A3"), (7, "C")]

The union of a list of maps, with a combining operation.
> unionsWith (++) [(fromList [(5, "a"), (3, "b")]), (fromList [(5, "A"), (7, "C")]), (fromList [(5, "A3"), (3, "B3")])]
> == fromList [(3, "bB3"), (5, "aAA3"), (7, "C")]

*O(min(n,W))*. Delete the maximal key. Returns an empty map if the map is empty.
Note that this is a change of behaviour for consistency with Map versions prior to 0.5 threw an error if the IntMap was already empty.
*O(min(n,W))*. Delete the minimal key. Returns an empty map if the map is empty.
Note that this is a change of behaviour for consistency with Map versions prior to 0.5 threw an error if the IntMap was already empty.
*O(n)*. The reverse of a sequence.

*O(log n)*. Delete the maximal element. Returns an empty set if the set is empty.

*O(log n)*. Delete the minimal element. Returns an empty set if the set is empty.

*O(n)*. Filter all values that satisfy some predicate.
> filter (> "a") (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"
> filter (> "x") (fromList [(5,"a"), (3,"b")]) == empty
> filter (< "a") (fromList [(5,"a"), (3,"b")]) == empty

*O(log n)*. Update the value at the maximal key.
> updateMax (\ a -> Just ("X" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "Xa")]
> updateMax (\ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"

*O(min(n,W))*. Update the value at the maximal key.
> updateMax (\ a -> Just ("X" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "Xa")]
> updateMax (\ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"

*O(log n)*. Update the value at the minimal key.
> updateMin (\ a -> Just ("X" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3, "Xb"), (5, "a")]
> updateMin (\ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"

*O(min(n,W))*. Update the value at the minimal key.
> updateMin (\ a -> Just ("X" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3, "Xb"), (5, "a")]
> updateMin (\ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"

*O(n+m)*. Difference between two maps (based on keys).
> difference (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 3 "b"

*O(n+m)*. The (left-biased) intersection of two maps (based on keys).
> intersection (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "a"

*O(n+m)*. The (left-biased) union of two maps. It prefers the first map when duplicate keys are encountered, i.e. (union == unionWith const).
> union (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == fromList [(3, "b"), (5, "a"), (7, "C")]
scanl1 is a variant of scanl that has no starting value argument:
> scanl1 f (fromList [x1, x2, ...]) = fromList [x1, x1 `f` x2, ...]
scanr1 is a variant of scanr that has no starting value argument.
Show more results