[{"name":"FingerTree","comment":" This package provides an implementation of 2-3 finger trees. Finger trees are a general purpose purely functional data structure that\ncan be used to efficiently implement many other kinds of data structures like priority queues. A finger tree is an annotated sequence, where each node\nstores the result of applying an associative operation to its descendents. This information (the \"annotation\" or \"tag\") can be used in a variety of ways to create\nnew data structures beyond just trees.\n\n\n# Core Types\n\n@docs Config, Tree\n\n\n## Note on annotations\n\nTo facilitate this data structure the annotations used should form a monoid in respect of the `Config` of the tree.\nThis means that the `combine` function you provide should be associative, and the `empty` value you provide should act as an identity element: `combine x empty == x` for any annotation `x`.\n\nI have used the term config because elm doesn't have the ability to prove the annotation type chosen does actually form a\nmonoid under the action of a particular function, and I think for the purposes of defining things like priority queue semantics (one of the main applications of a finger tree)\n\"config\" makes more sense.\n\n\n# Creation\n\n@docs create, empty\n\n\n# Inserting elements\n\n@docs consLeft, consRight, appendList, prependList\n\n\n# Retrieving elements and subtrees\n\n@docs isEmpty, annotation, head, tail, prefix, last, viewLeft, viewRight, length\n\n\n# Working on trees\n\n@docs append, split, splitAt, cut, foldLeft, foldRight, toList, equal\n\n\n# Working with annotations and elements\n\n@docs Tagged, unconsLeft, unconsRight, cutWithTag, foldLeftWithTag, foldRightWithTag\n\n\n# Helpers for working with tree configuration\n\n@docs config, mempty, mappend, annotator\n\n","unions":[{"name":"Config","comment":" The Config type records the `tag` type's semantics. This includes the zero value, and the `combine` definition in used.\nThis type could also be called \"annotator\" or \"decorator\", because it tells the functions in this module how they should\nannotate the nodes of the tree.\n","args":["a","tag"],"cases":[]},{"name":"Tree","comment":" The Tree type is a finger tree with elements of type `a` annotated by type `tag`, instantiated with a particular tag `Config`.\n","args":["a","tag"],"cases":[]}],"aliases":[{"name":"Tagged","comment":" Type alias for pairs of elements and their tag.\n","args":["a","tag"],"type":"( tag, a )"}],"values":[{"name":"annotation","comment":" Extract the tree's annotation. There a few things to keep in mind here:\n\n  - If the tree is empty the empty annotation of the tree's config is returned.\n  - This is the cumulative combination / sum of the annotations of the tree's elements.\n\n","type":"FingerTree.Tree a tag -> tag"},{"name":"annotator","comment":" The function that assigns elements their annotation used by the tree config.\n","type":"FingerTree.Config a tag -> a -> tag"},{"name":"append","comment":" Append two trees, this is like joining the second tree to the end of the first tree.\n","type":"FingerTree.Tree a tag -> FingerTree.Tree a tag -> FingerTree.Tree a tag"},{"name":"appendList","comment":" Add a list of elements to a tree by consing them to the right side/the end.\n","type":"List.List a -> FingerTree.Tree a tag -> FingerTree.Tree a tag"},{"name":"config","comment":" Extract the config being used by the tree.\n","type":"FingerTree.Tree a tag -> FingerTree.Config a tag"},{"name":"consLeft","comment":" Add an element to a tree at the left side/the start.\n","type":"a -> FingerTree.Tree a tag -> FingerTree.Tree a tag"},{"name":"consRight","comment":" Add an element to the tree at the right side/the end.\n","type":"a -> FingerTree.Tree a tag -> FingerTree.Tree a tag"},{"name":"create","comment":" Create a new tree config. You need to provide a function that annotates nodes, an **associative** function which can be used to combine two annotations, and a zero value for the annotations to start with.\nThe zero value is only used to initialise accumulators, and ideally should not be used as an actual annotation. It should be the identity element of `combine`.\n","type":"{ annotate : a -> tag, combine : tag -> tag -> tag, empty : tag } -> FingerTree.Config a tag"},{"name":"cut","comment":" Cut the tree, extracting everything before the predicate, the first value for which the predicate is true (if it is) and everything afterward.\n","type":"(tag -> Basics.Bool) -> FingerTree.Tree a tag -> ( FingerTree.Tree a tag, Maybe.Maybe a, FingerTree.Tree a tag )"},{"name":"cutWithTag","comment":" Like `split` but also returns the annotation of the element which caused the split.\n","type":"(tag -> Basics.Bool) -> FingerTree.Tree a tag -> ( FingerTree.Tree a tag, Maybe.Maybe (FingerTree.Tagged a tag), FingerTree.Tree a tag )"},{"name":"empty","comment":" Given the config you want to use, create an empty tree using that config.\n","type":"FingerTree.Config a tag -> FingerTree.Tree a tag"},{"name":"equal","comment":" Check if two trees are equal by comparing their elements from left to right.\n","type":"FingerTree.Tree a tag -> FingerTree.Tree a tag -> Basics.Bool"},{"name":"foldLeft","comment":" Perform a fold on the tree from left to right; using the same argument order as `List.foldl`.\n","type":"(a -> b -> b) -> b -> FingerTree.Tree a tag -> b"},{"name":"foldLeftWithTag","comment":" Like `foldLeft` but uses the natural argument order and uses the annotation and element to fold.\n","type":"(b -> FingerTree.Tagged a tag -> b) -> b -> FingerTree.Tree a tag -> b"},{"name":"foldRight","comment":" Perform a fold on the tree from right to left; using the same argument order as `List.foldr`.\n","type":"(a -> b -> b) -> b -> FingerTree.Tree a tag -> b"},{"name":"foldRightWithTag","comment":" Like `foldRight` but uses the natural argument order and uses the annotation and element to fold.\n","type":"(FingerTree.Tagged a tag -> b -> b) -> FingerTree.Tree a tag -> b -> b"},{"name":"head","comment":" Extract the leftmost / first element of the tree.\n","type":"FingerTree.Tree a tag -> Maybe.Maybe a"},{"name":"isEmpty","comment":" Check if the tree is empty.\n","type":"FingerTree.Tree a tag -> Basics.Bool"},{"name":"last","comment":" Extract the rightmost/last element of the tree.\n","type":"FingerTree.Tree a tag -> Maybe.Maybe a"},{"name":"length","comment":" This function counts the number of elements in the tree by visiting each element. You could also use the annotation to keep track of this.\n","type":"FingerTree.Tree a tag -> Basics.Int"},{"name":"mappend","comment":" The associative operation that combines annotations used by the tree config.\n","type":"FingerTree.Config a tag -> tag -> tag -> tag"},{"name":"mempty","comment":" The empty value used by the tree config.\n","type":"FingerTree.Config a tag -> tag"},{"name":"prefix","comment":" Remove the rightmost / last element of the tree.\n","type":"FingerTree.Tree a tag -> Maybe.Maybe (FingerTree.Tree a tag)"},{"name":"prependList","comment":" Add a list of elements to a tree by consing them to the left side/the start.\n","type":"List.List a -> FingerTree.Tree a tag -> FingerTree.Tree a tag"},{"name":"split","comment":" Split a tree using a monotonic predicate on the tags. The first tree of the result is everything before the predicate was true,\nand the final result is the everything afterwards.\n\nThe predicate being monotonic means that if it's true for a tag `t` then it's also true for any `combine t x`.\n\n","type":"(tag -> Basics.Bool) -> FingerTree.Tree a tag -> ( FingerTree.Tree a tag, FingerTree.Tree a tag )"},{"name":"splitAt","comment":" Split a tree at a the given tag. This function needs the tags to be comparable so that it can split the tree by `tag >= i`.\n","type":"comparableTag -> FingerTree.Tree a comparableTag -> ( FingerTree.Tree a comparableTag, FingerTree.Tree a comparableTag )"},{"name":"tail","comment":" Remove the leftmost / first element of the tree.\n","type":"FingerTree.Tree a tag -> Maybe.Maybe (FingerTree.Tree a tag)"},{"name":"toList","comment":" Convert a tree into a regular elm list. The elements are ordered from left to right.\n","type":"FingerTree.Tree a tag -> List.List a"},{"name":"unconsLeft","comment":" Like `viewLeft` but also returns the annotation of the element.\n","type":"FingerTree.Tree a tag -> Maybe.Maybe ( FingerTree.Tagged a tag, FingerTree.Tree a tag )"},{"name":"unconsRight","comment":" Like `viewRight` but also returns the annotation of the element.\n","type":"FingerTree.Tree a tag -> Maybe.Maybe ( FingerTree.Tagged a tag, FingerTree.Tree a tag )"},{"name":"viewLeft","comment":" Extract the leftmost element from the tree and return it and the remaining tree.\n","type":"FingerTree.Tree a tag -> Maybe.Maybe ( a, FingerTree.Tree a tag )"},{"name":"viewRight","comment":" Extract the rightmost element from the tree and return it and the remaining tree.\n","type":"FingerTree.Tree a tag -> Maybe.Maybe ( a, FingerTree.Tree a tag )"}],"binops":[]}]