y0hy0h/ordered-containers/1.0.0

NOTE: the latest version is 2.0.3

Renamed to j-maas/ordered-containers. That is where the repository lives now. It has not been published as a package under the new name.

Versions published as y0hy0h/ordered-containers still install under that name. 5 versions of 5 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/j-maas/ordered-containers.

What we checked: The repo moved to github.com/j-maas/ordered-containers and tag 1.0.0 is there; its commit b079cbc2a79a is from 2018-08-28 21:06 UTC, before the version was published (2018-08-28 21:07 UTC); every file Elm uses matches a copy in a Lamdera package cache from 2021-02-13, from before the change; elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip's SHA-1 is not the published one (GitHub's zip no longer comes out byte for byte the same), so the contents were checked instead.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/y0hy0h/ordered-containers/zipball/1.0.0/

OrderedSet

A set of unique values that when iterated or converted to a list, the order of values will be the same as the order they were inserted.

As it uses Dict under the hood, the keys can only be comparable types, which include Int, Float, Time, Char, String, and tuples or lists of comparable types.

Sets

type OrderedSet comparable

A type of Set that is iterated by the order of insertion.

Build

empty : OrderedSet comparable

Create an empty set.

singleton : comparable -> OrderedSet comparable

Create a set with one value.

insert : comparable -> OrderedSet comparable -> OrderedSet comparable

Insert a value into a set.

remove : comparable -> OrderedSet comparable -> OrderedSet comparable

Remove a value from a set. If the value doesn't exist, no changes are made.

Query

isEmpty : OrderedSet comparable -> Bool

Check if a set is empty.

member : comparable -> OrderedSet comparable -> Bool

Check if a value is in a set.

size : OrderedSet comparable -> Int

Get the number of values in the set.

Lists

toList : OrderedSet comparable -> List comparable

Convert a set into a list, sorted by insertion order.

fromList : List comparable -> OrderedSet comparable

Convert a list into a set, removing any duplicates.

Transform

map :
(comparable -> comparable2)
-> OrderedSet comparable
-> OrderedSet comparable2

Apply a function to all values in a set.

foldl : (comparable -> b -> b) -> b -> OrderedSet comparable -> b

Fold the values in a set, in insertion order.

foldr : (comparable -> b -> b) -> b -> OrderedSet comparable -> b

Fold the values in a set, in reverse insertion order.

(comparable -> Bool)
-> OrderedSet comparable
-> OrderedSet comparable

Return a new OrderedSet that only contains values that satisfy a predicate.

(comparable -> Bool)
-> OrderedSet comparable
-> ( OrderedSet comparable, OrderedSet comparable )

Split a OrderedSet to a tuple of OrderedSet. The first contains all values that satisfy the predicate, and the second contains the rest.

Combine

OrderedSet comparable
-> OrderedSet comparable
-> OrderedSet comparable

Combine two sets. Keep all values while removing any duplicates.

OrderedSet comparable
-> OrderedSet comparable
-> OrderedSet comparable

Combine two sets. Keep values that appear in both sets.

OrderedSet comparable
-> OrderedSet comparable
-> OrderedSet comparable

Keep values of the first set that do not appear in the second set.