[{"name":"Set.Any","comment":" A set of unique values. Similar to elm/core Set but allows arbitrary data\ngiven a function for converting to `comparable` can be provided.\n\nInsert, remove, and query operations all take O(log n) time.\n\n\n# Converting Types to Comparable\n\nWhen writing a function for conversion from the type you want to use within a set to comparable\n**it's very important to make sure every distinct member of the type produces different value in the set of comparables**.\nFunctions satisfying this property are called [injective](https://en.wikipedia.org/wiki/Injective_function).\n\nTake for instance those two examples:\n\nWe can use store Bool in Set (No matter how unpractical it might seem)\n\n    boolToInt : Bool -> Int\n    boolToInt bool =\n        case bool of\n            False -> 0\n            True -> 1\n\n    empty boolToInt\n    |> insert True\n    |> member True\n    --> True\n\nor Maybe String.\n\n    comparableKey : Maybe String -> (Int, String)\n    comparableKey maybe =\n        case maybe of\n            Nothing -> (0, \"\")\n            Just str -> (1, str)\n\n    empty comparableKey\n        |> insert (Just \"foo\")\n        |> member (Just \"foo\")\n    --> True\n\nNote that we give Int code to either constructor and in case of Nothing we default to `\"\"` (empty string).\nThere is still a difference between `Nothing` and `Just \"\"` (`Int` value in the pair is different).\nIn fact, you can \"hardcode\" any value as the second member of the pair\nin case of Nothing but empty string seems like a reasonable option for this case.\nGenerally, this is how I would implement `toComparable` function for most of your custom data types.\nHave a look at the longest constructor,\nDefine tuple where the first key is int (number of the constructor)\nand other are types within the constructor and you're good to go.\n\n\n# AnySet\n\n@docs AnySet, equal\n\n\n# Build\n\n@docs empty, singleton, insert, remove, removeAll, toggle\n\n\n# Query\n\n@docs isEmpty, member, get, size, any, all\n\n\n# Combine\n\n@docs union, intersect, diff, symDifference\n\n\n# Lists\n\n@docs toList, fromList\n\n\n# Transform\n\n@docs map, foldl, foldr, filter, partition, filterMap\n\n\n# Set\n\n@docs toSet\n\n\n# Json\n\n@docs decode, encode\n\n","unions":[{"name":"AnySet","comment":" Represents a set of unique values.\n\nBe aware that AnySet stores a function internally.\nThis means it's not possible to use `(==)` for comparing two AnySets.\nUse [equal](#equal) function instead.\n\n","args":["comparable","t"],"cases":[["AnySet",["Dict.Any.AnyDict comparable t ()"]]]}],"aliases":[],"values":[{"name":"all","comment":" Find out if all values in set match a predicate.\n\n    type Animal = Cat | Mouse | Dog\n\n    animalToInt : Animal -> Int\n    animalToInt animal =\n        case animal of\n            Cat -> 0\n            Mouse -> 1\n            Dog -> 2\n\n    animals : AnySet Int Animal\n    animals =\n        [ Cat, Mouse ]\n            |> fromList animalToInt\n\n    aristocats : AnySet Int Animal\n    aristocats =\n        [ Cat ]\n            |> fromList animalToInt\n\n    isACat : Animal -> Bool\n    isACat animal =\n        case animal of\n            Cat -> True\n            _ -> False\n\n    all isACat animals\n    --> False\n\n    all isACat aristocats\n    --> True\n\n","type":"(v -> Basics.Bool) -> Set.Any.AnySet comparable v -> Basics.Bool"},{"name":"any","comment":" Find out if there is any instance of something in a set.\n\n    type Animal = Cat | Mouse | Dog\n\n    animalToInt : Animal -> Int\n    animalToInt animal =\n        case animal of\n            Cat -> 0\n            Mouse -> 1\n            Dog -> 2\n\n    animals : AnySet Int Animal\n    animals =\n        [ Cat, Mouse ]\n            |> fromList animalToInt\n\n    isACat : Animal -> Bool\n    isACat animal =\n        case animal of\n            Cat -> True\n            _ -> False\n\n    any isACat animals\n    --> True\n\n","type":"(v -> Basics.Bool) -> Set.Any.AnySet comparable v -> Basics.Bool"},{"name":"decode","comment":" Decode `AnySet` from JSON array.\n","type":"(a -> comparable) -> Json.Decode.Decoder a -> Json.Decode.Decoder (Set.Any.AnySet comparable a)"},{"name":"diff","comment":" Get the difference between the first set and the second. Keeps values\nthat do not appear in the second set.\n","type":"Set.Any.AnySet comparable a -> Set.Any.AnySet comparable a -> Set.Any.AnySet comparable a"},{"name":"empty","comment":" Create an empty set.\n\n\\*\\* Note that it's important to make sure every key is turned to different comparable.\\*\\*\nOtherwise keys would conflict and overwrite each other.\n\n","type":"(a -> comparable) -> Set.Any.AnySet comparable a"},{"name":"encode","comment":" Turn `AnySet` into JSON array.\n","type":"(a -> Json.Encode.Value) -> Set.Any.AnySet comparable a -> Json.Encode.Value"},{"name":"equal","comment":" Check equality of two `AnySet`s\n","type":"Set.Any.AnySet comparable t -> Set.Any.AnySet comparable t -> Basics.Bool"},{"name":"filter","comment":" Only keep elements that pass the given test.\n","type":"(a -> Basics.Bool) -> Set.Any.AnySet comparable a -> Set.Any.AnySet comparable a"},{"name":"filterMap","comment":" Apply a function that may or may not succeed to all entries in a set, but only keep the successes.\n\n    type Animal = Cat | Mouse | Dog\n\n    animalToInt : Animal -> Int\n    animalToInt animal =\n        case animal of\n            Cat -> 0\n            Mouse -> 1\n            Dog -> 2\n\n    animals : AnySet Int Animal\n    animals =\n        [ Cat, Mouse ]\n            |> fromList animalToInt\n\n    onlyTom : AnySet String String\n    onlyTom =\n        [ \"Tom\" ]\n            |> fromList identity\n\n    getCatName : Animal -> Maybe String\n    getCatName animal =\n        case animal of\n            Cat -> Just \"Tom\"\n            _ -> Nothing\n\n    filterMap identity getCatName animals == onlyTom\n    --> True\n\n","type":"(b -> comparable) -> (a -> Maybe.Maybe b) -> Set.Any.AnySet comparable2 a -> Set.Any.AnySet comparable b"},{"name":"foldl","comment":" Fold over the values in a set, in order from highest to lowest.\n","type":"(a -> b -> b) -> b -> Set.Any.AnySet comparable a -> b"},{"name":"foldr","comment":" Fold over the values in a set, in order from lowest to highest.\n","type":"(a -> b -> b) -> b -> Set.Any.AnySet comparable a -> b"},{"name":"fromList","comment":" Convert a list into a set, removing any duplicates.\n","type":"(a -> comparable) -> List.List a -> Set.Any.AnySet comparable a"},{"name":"get","comment":" Get a value from set.\n\nThis is useful in case of `AnySet` because\nsome parts of a value might not be used\nfor generating comparable.\nThis function allows quering `AnySet` with old\nvalue to obtain updated one in such cases.\n\n","type":"a -> Set.Any.AnySet comparable a -> Maybe.Maybe a"},{"name":"insert","comment":" Insert a value into a set.\n","type":"a -> Set.Any.AnySet comparable a -> Set.Any.AnySet comparable a"},{"name":"intersect","comment":" Get the intersection of two sets. Keeps values that appear in both sets.\n","type":"Set.Any.AnySet comparable a -> Set.Any.AnySet comparable a -> Set.Any.AnySet comparable a"},{"name":"isEmpty","comment":" Determine if a set is empty.\n","type":"Set.Any.AnySet comparable a -> Basics.Bool"},{"name":"map","comment":" Map a function onto a set, creating a new set with no duplicates.\n","type":"(b -> comparable2) -> (a -> b) -> Set.Any.AnySet comparable a -> Set.Any.AnySet comparable2 b"},{"name":"member","comment":" Determine if a value is in a set.\n","type":"a -> Set.Any.AnySet comparable a -> Basics.Bool"},{"name":"partition","comment":" Create two new sets. The first contains all the elements that passed the\ngiven test, and the second contains all the elements that did not.\n","type":"(a -> Basics.Bool) -> Set.Any.AnySet comparable a -> ( Set.Any.AnySet comparable a, Set.Any.AnySet comparable a )"},{"name":"remove","comment":" Remove a value from a set. If the value is not found, no changes are made.\n","type":"a -> Set.Any.AnySet comparable a -> Set.Any.AnySet comparable a"},{"name":"removeAll","comment":" Remove all entries from AnySet.\n\nUseful when you need to create new empty AnySet using\nsame comparable function for key type.\n\n","type":"Set.Any.AnySet comparable a -> Set.Any.AnySet comparable a"},{"name":"singleton","comment":" Create a set with one value.\n\n\\*\\* Note that it's important to make sure every key is turned to different comparable.\\*\\*\nOtherwise keys would conflict and overwrite each other.\n\n","type":"a -> (a -> comparable) -> Set.Any.AnySet comparable a"},{"name":"size","comment":" Determine the number of elements in a set.\n","type":"Set.Any.AnySet comparable a -> Basics.Int"},{"name":"symDifference","comment":" In Math, the symmetric difference of two sets, also known as _disjunctive union_ is the set\nof elements which are in either of the sets, but not in their intersection. For example, the\nsymmetric difference of the sets {1,2,3} and {3,4} is {1,2,4}.\n\nSee <https://en.m.wikipedia.org/wiki/Symmetric_difference> for more reference.\n\n    type Animal = Cat | Mouse | Dog\n\n    animalToInt : Animal -> Int\n    animalToInt animal =\n        case animal of\n            Cat -> 0\n            Mouse -> 1\n            Dog -> 2\n\n    animals : AnySet Int Animal\n    animals =\n        [ Cat, Mouse ]\n            |> fromList animalToInt\n\n    moreAnimals : AnySet Int Animal\n    moreAnimals =\n        [ Mouse, Dog ]\n            |> fromList animalToInt\n\n    diffAnimals : AnySet Int Animal\n    diffAnimals =\n        [ Cat, Mouse, Dog ]\n            |> fromList animalToInt\n\n    symDifference animals moreAnimals == diffAnimals\n    --> True\n\n","type":"Set.Any.AnySet comparable a -> Set.Any.AnySet comparable a -> Set.Any.AnySet comparable a"},{"name":"toList","comment":" Convert a set into a list, sorted from lowest to highest.\n","type":"Set.Any.AnySet comparable a -> List.List a"},{"name":"toSet","comment":" Convert AnySet to elm/core Set of comparable\n","type":"Set.Any.AnySet comparable a -> Set.Set comparable"},{"name":"toggle","comment":" Toggle a value in a set. If it's not found, it's inserted, else it's removed.\n","type":"a -> Set.Any.AnySet comparable a -> Set.Any.AnySet comparable a"},{"name":"union","comment":" Get the union of two sets. Keep all values.\n","type":"Set.Any.AnySet comparable a -> Set.Any.AnySet comparable a -> Set.Any.AnySet comparable a"}],"binops":[]}]