[{"name":"Lazy","comment":" This library lets you delay a computation until later.\n\n\n# Basics\n\n@docs Lazy, lazy, force, evaluate\n\n\n# Mapping\n\n@docs map, map2, map3, map4, map5\n\n\n# Chaining\n\n@docs apply, andMap, andThen\n\n","unions":[{"name":"Lazy","comment":" A wrapper around a value that will be lazily evaluated.\n","args":["a"],"cases":[]}],"aliases":[],"values":[{"name":"andMap","comment":" Piping-friendly version of `apply`.\n\n    map3 : (a -> b -> c -> result) -> Lazy a -> Lazy b -> Lazy c -> Lazy result\n    map3 f a b c =\n        lazy (\\() -> f) |> andMap a |> andMap b |> andMap c\n\n","type":"Lazy.Lazy a -> Lazy.Lazy (a -> b) -> Lazy.Lazy b"},{"name":"andThen","comment":" Lazily chain lazy computations together, for when you have a series of\nsteps that all need to be performed lazily. This can be nice when you need to\npattern match on a value, for example, when appending lazy lists:\n\n    type List a = Empty | Node a (Lazy (List a))\n\n    cons : a -> Lazy (List a) -> Lazy (List a)\n    cons first rest =\n        Lazy.map (Node first) rest\n\n    append : Lazy (List a) -> Lazy (List a) -> Lazy (List a)\n    append lazyList1 lazyList2 =\n        let\n            appendHelp list1 =\n                case list1 of\n                    Empty ->\n                        lazyList2\n                    Node first rest ->\n                        cons first (append rest list2))\n      in\n      lazyList1 |> Lazy.andThen appendHelp\n\nBy using `andThen` we ensure that neither `lazyList1` or `lazyList2` are forced\nbefore they are needed. So as written, the `append` function delays the pattern\nmatching until later.\n\n","type":"(a -> Lazy.Lazy b) -> Lazy.Lazy a -> Lazy.Lazy b"},{"name":"apply","comment":" Lazily apply a lazy function to a lazy value. This is pretty rare on its\nown, but it lets you map as high as you want.\n\n    map3 : (a -> b -> c -> result) -> Lazy a -> Lazy b -> Lazy c -> Lazy result\n    map3 f a b c =\n        apply (apply (apply (lazy (\\() -> f)) a) b) c\n\nIt is not the most beautiful, but it is equivalent and will let you create\n`map9` quite easily if you really need it.\n\n","type":"Lazy.Lazy (a -> b) -> Lazy.Lazy a -> Lazy.Lazy b"},{"name":"evaluate","comment":" Evaluate the lazy value if it has not already been evaluated. If it has,\ndo nothing.\n\n    lazySum : Lazy Int\n    lazySum =\n        lazy (() -> List.sum <| List.range 1 1000000)\n\n    sums : ( Int, Int, Int )\n    sums =\n        let\n        evaledSum =\n            evaluate lazySum\n\n        in\n        ( force evaledSum, force evaledSum, force evaledSum )\n\nThis is mainly useful for cases where you may want to store a lazy value as a\nlazy value and pass it around. For example, in a list. Where possible, it is better to use\n`force` and simply store the computed value separately.\n\n","type":"Lazy.Lazy a -> Lazy.Lazy a"},{"name":"force","comment":" Force the evaluation of a lazy value. This means we only pay for the\ncomputation when we need it. Here is a rather contrived example.\n\n    lazySum : Lazy Int\n    lazySum =\n        lazy (() -> List.sum <| List.range 1 1000000)\n\n    sums : ( Int, Int, Int )\n    sums =\n        ( force lazySum, force lazySum, force lazySum )\n\n","type":"Lazy.Lazy a -> a"},{"name":"lazy","comment":" Delay the evaluation of a value until later. For example, maybe we will\nneed to generate a very long list and find its sum, but we do not want to do\nit unless it is absolutely necessary.\n\n    lazySum : Lazy Int\n    lazySum =\n        lazy (() -> sum <| List.range 1 1000000)\n\nNow we only pay for `lazySum` if we actually need it.\n\n","type":"(() -> a) -> Lazy.Lazy a"},{"name":"map","comment":" Lazily apply a function to a lazy value.\n\n    lazySum : Lazy Int\n    lazySum =\n        map List.sum (lazy (() -> List.range 1 1000000)\n\nThe resulting lazy value will create a big list and sum it up when it is\nfinally forced.\n\n","type":"(a -> b) -> Lazy.Lazy a -> Lazy.Lazy b"},{"name":"map2","comment":" Lazily apply a function to two lazy values.\n\n    lazySum : Lazy Int\n    lazySum =\n        lazy (() -> List.sum <| List.range 1 1000000)\n\n    lazySumPair : Lazy ( Int, Int )\n    lazySumPair =\n        map2 (,) lazySum lazySum\n\n","type":"(a -> b -> result) -> Lazy.Lazy a -> Lazy.Lazy b -> Lazy.Lazy result"},{"name":"map3","comment":" ","type":"(a -> b -> c -> result) -> Lazy.Lazy a -> Lazy.Lazy b -> Lazy.Lazy c -> Lazy.Lazy result"},{"name":"map4","comment":" ","type":"(a -> b -> c -> d -> result) -> Lazy.Lazy a -> Lazy.Lazy b -> Lazy.Lazy c -> Lazy.Lazy d -> Lazy.Lazy result"},{"name":"map5","comment":" ","type":"(a -> b -> c -> d -> e -> result) -> Lazy.Lazy a -> Lazy.Lazy b -> Lazy.Lazy c -> Lazy.Lazy d -> Lazy.Lazy e -> Lazy.Lazy result"}],"binops":[]},{"name":"Lazy.LList","comment":" This module implements lazy construction of strict List.\nIt is not Lazy List implementation and it has different characteristics.\nIt's mostly intended for internal purposes of this library and is exposed\njust in case some additional user extensions will need it.\n\n\n# Types & Constructors\n\n@docs LList, empty, singleton, llist, fromList\n\n\n# Operations\n\n@docs cons, append\n\n\n# Query\n\n@docs isEmpty, toList, head, tail\n\n\n# Transformations\n\n@docs map, map2, filter, filterMap, reverse, sort, sortBy, sortWith, stableSortWith, foldr, foldl, concat, andThen\n\n","unions":[],"aliases":[{"name":"LList","comment":" **`LList` uses lazy implementation and therefore can't be compared using `==`**\n","args":["a"],"type":"Lazy.Lazy (List.List a)"}],"values":[{"name":"andThen","comment":" Map `LList` construction over `LList`.\n\n    cons \"foo\" (cons \"bar\" <| singleton \"baz\")\n        |> andThen (\\a -> cons a <| singleton (a ++ \" fighter\" ))\n        |> toList\n    --> [ \"foo\", \"foo fighter\", \"bar\", \"bar fighter\", \"baz\", \"baz fighter\" ]\n\nThis function is performed lazily.\n\n","type":"(a -> Lazy.LList.LList b) -> Lazy.LList.LList a -> Lazy.LList.LList b"},{"name":"append","comment":" Append `LList` to `LList`.\n\n    append (singleton \"foo\") (fromList [ \"bar\", \"baz\" ])\n        |> toList\n    --> [ \"foo\", \"bar\", \"baz\" ]\n\nThis function is performed lazily.\n\n","type":"Lazy.LList.LList a -> Lazy.LList.LList a -> Lazy.LList.LList a"},{"name":"concat","comment":" Flatten `LList`.\n\n    fromList [ singleton \"foo\", cons \"bar\" <| singleton \"baz\" ]\n       |> concat\n       |> toList\n    --> [ \"foo\", \"bar\", \"baz\" ]\n\nThis function is performed lazily.\n\n","type":"Lazy.LList.LList (Lazy.LList.LList a) -> Lazy.LList.LList a"},{"name":"cons","comment":" Add element to `LList`.\n\n    empty\n        |> cons \"bar\"\n        |> cons \"foo\"\n        |> toList\n    --> [ \"foo\", \"bar\" ]\n\nThis function is performed lazily.\n\n","type":"a -> Lazy.LList.LList a -> Lazy.LList.LList a"},{"name":"empty","comment":" Initialize empty `LList`.\n\n    toList empty\n    --> []\n\n","type":"Lazy.LList.LList a"},{"name":"filter","comment":" Filter `LList`.\n\n    (cons 1 <| cons 2 <| cons 3 empty)\n        |> filter ((<) 1)\n        |> toList\n    --> [ 2, 3 ]\n\nThis function is performed lazily.\n\n","type":"(a -> Basics.Bool) -> Lazy.LList.LList a -> Lazy.LList.LList a"},{"name":"filterMap","comment":" Similar to `List.filterMap` but for `LList`.\n\n    (cons 1 <| cons 2 <| cons 3 empty)\n        |> filterMap (\\a -> if 1 < a then Just (2 * a) else Nothing)\n        |> toList\n    --> [ 4, 6 ]\n\nThis function is performed lazily.\n\n","type":"(a -> Maybe.Maybe b) -> Lazy.LList.LList a -> Lazy.LList.LList b"},{"name":"foldl","comment":" Same as `List.foldl` but for `LLists`.\n\n    llist (List.range 0) 5\n        |> foldl (+) 0\n    --> 15\n\n    llist (List.range 0) 3\n        |> foldl (::) []\n    --> [ 3, 2, 1, 0 ]\n\nThis function forces evaluation.\n\n","type":"(a -> b -> b) -> b -> Lazy.LList.LList a -> b"},{"name":"foldr","comment":" Same as `List.foldr` but for `LLists`.\n\n    llist (List.range 0) 5\n        |> foldr (+) 0\n    --> 15\n\n    llist (List.range 0) 3\n        |> foldr (::) []\n    --> [ 0, 1, 2, 3 ]\n\nThis function forces evaluation.\n\n","type":"(a -> b -> b) -> b -> Lazy.LList.LList a -> b"},{"name":"fromList","comment":" Construct `LList` from `List`.\n\n    fromList [ \"foo\", \"bar\", \"baz\" ]\n        |> toList\n    --> [ \"foo\", \"bar\", \"baz\" ]\n\n","type":"List.List a -> Lazy.LList.LList a"},{"name":"head","comment":" Get the first element from `LList`.\n\n    head empty\n    --> Nothing\n\n    llist (List.range 0) 2\n       |> head\n    --> Just 0\n\nThis function forces evaluation.\n\n","type":"Lazy.LList.LList a -> Maybe.Maybe a"},{"name":"isEmpty","comment":" Check if `LList` is empty.\n\n    isEmpty empty\n    --> True\n\n    isEmpty (singleton \"foo\")\n    --> False\n\n    llist (List.filter <| \\a -> a > 10) [ 1, 2, 3 ]\n        |> isEmpty\n    --> True\n\nThis function forces evaluation.\n\n","type":"Lazy.LList.LList a -> Basics.Bool"},{"name":"llist","comment":" Init `LList` using constructor.\n\n`LList` is initialized using a function from `a -> List b`.\nEvaluation of this function is lazy and happens in time when\nactual value is needed, not when constructor is called.\n\nFor instance you can use some `List` constructor:\n\n    llist (List.range 0) 5\n        |> toList\n    --> [ 0, 1, 2, 3, 4, 5 ]\n\nOr use any other function you need`List`:\n\n    llist (List.filter <| \\a -> modBy 2 a == 0) (List.range 0 10)\n        |> toList\n    --> [ 0, 2, 4, 6, 8, 10 ]\n\n","type":"(a -> List.List b) -> a -> Lazy.LList.LList b"},{"name":"map","comment":" Map function over `LList`.\n\n    llist (List.range 0) 5\n        |> map ((*) 2)\n        |> toList\n    --> [ 0, 2, 4, 6, 8, 10 ]\n\nThis function is performed lazily.\n\n","type":"(a -> b) -> Lazy.LList.LList a -> Lazy.LList.LList b"},{"name":"map2","comment":" Map a functions over two `LList`s.\n\n    llist (List.range 0) 5\n        |> map2 (+) (llist (List.range 0) 5)\n        |> toList\n    --> [ 0, 2, 4, 6, 8, 10 ]\n\nThis function is performed lazily.\n\n","type":"(a -> b -> c) -> Lazy.LList.LList a -> Lazy.LList.LList b -> Lazy.LList.LList c"},{"name":"reverse","comment":" Reverse `LList`.\n\n    fromList [ 1, 2, 3 ]\n        |> reverse\n        |> toList\n    --> [ 3, 2, 1 ]\n\nThis function is performed lazily.\n\n","type":"Lazy.LList.LList a -> Lazy.LList.LList a"},{"name":"singleton","comment":" Initialize singleton `LList`.\n\n    singleton \"foo\"\n        |> toList\n    --> [ \"foo\" ]\n\n","type":"a -> Lazy.LList.LList a"},{"name":"sort","comment":" Sort by for `LList`.\n\n    fromList [ 3, 1, 2 ]\n        |> sort\n        |> toList\n    --> [ 1, 2, 3 ]\n\nThis function is performed lazily.\n\n","type":"Lazy.LList.LList comparable -> Lazy.LList.LList comparable"},{"name":"sortBy","comment":" Sort by for `LList`.\n\n    fromList [ 3, 1, 2 ]\n        |> sortBy identity\n        |> toList\n    --> [ 1, 2, 3 ]\n\n    fromList [ { val = \"c\"} , { val = \"b\"}, { val = \"a\"} ]\n        |> sortBy .val\n        |> toList\n    -->  [ { val = \"a\"}, { val = \"b\"}, { val = \"c\"} ]\n\nThis function is performed lazily.\n\n","type":"(a -> comparable) -> Lazy.LList.LList a -> Lazy.LList.LList a"},{"name":"sortWith","comment":" Sort with for `LList`\n\n    flippedComparison : comparable -> comparable -> Order\n    flippedComparison a b =\n        case Basics.compare a b of\n            LT -> GT\n            EQ -> EQ\n            GT -> LT\n\n    llist (List.range 1) 5\n        |> sortWith flippedComparison\n        |> toList\n    --> [ 5, 4, 3, 2, 1 ]\n\nThis function is performed lazily.\n\n","type":"(a -> a -> Basics.Order) -> Lazy.LList.LList a -> Lazy.LList.LList a"},{"name":"stableSortWith","comment":" Stable sort with for `LList`.\nThe original order is guaranteed to be kept if the comparison returns `EQ`.\n\n    compareAge : { r | age : comparable } -> { r | age : comparable } -> Order\n    compareAge a b =\n        Basics.compare a.age b.age\n\n    fromList [ { name = \"Joe\", age = 25 }, { name = \"Sue\", age = 25 }, { name = \"Johann\", age = 23 } ]\n        |> stableSortWith compareAge\n        |> toList\n    --> [ { name = \"Johann\", age = 23 }, { name = \"Joe\", age = 25 }, { name = \"Sue\", age = 25 } ]\n\nThis function is performed lazily.\n\n","type":"(a -> a -> Basics.Order) -> Lazy.LList.LList a -> Lazy.LList.LList a"},{"name":"tail","comment":" Get the first element from `LList`.\n\n    tail empty\n    --> Nothing\n\n    tail (singleton \"foo\")\n        |> Maybe.map toList\n    --> Just []\n\n    llist (List.range 0) 2\n        |> tail\n        |> Maybe.map toList\n    --> Just [ 1, 2 ]\n\nThis function forces evaluation.\n\n","type":"Lazy.LList.LList a -> Maybe.Maybe (Lazy.LList.LList a)"},{"name":"toList","comment":" Build `List` from `LList`.\n\n    toList empty\n    --> []\n\n    toList <| llist (List.range 0) 2\n    --> [ 0, 1, 2 ]\n\nThis function forces evaluation.\n\n","type":"Lazy.LList.LList a -> List.List a"}],"binops":[]},{"name":"Lazy.Tree","comment":" This module implements Rose Tree data structure.\n\n> In computing, a multi-way tree or rose tree is a tree data structure\n> with a variable and unbounded number of branches per node.\n\nThis particular implementation uses lazy list construction (using `LList` module)\nto lazily evaluate levels of Tree.\n\n\n# Types & Constructor\n\n@docs Tree, Forest, singleton, build, fromList, fromKeyedList\n\n\n# Query\n\n@docs isEmpty, item, children, descendants\n\n\n# Modify\n\n@docs insert\n\n\n# Transforms\n\n@docs map, map2, filter, filterMap, sort, sortBy, sortWith, stableSortWith, andMap, flatten, andThen, duplicate, extend\n\n\n# Forest\n\n@docs forestMap, forestMap2\n\n","unions":[{"name":"Tree","comment":" \\*\\* Be careful when comparing `Tree`s using `(==)`.\\*\\*\nDue to use of laziness `(==)` isn't reliable for comparing Trees.\n","args":["a"],"cases":[["Tree",["a","Lazy.Tree.Forest a"]]]}],"aliases":[{"name":"Forest","comment":" \\*\\* Be careful when comparing `Forest`s using `(==)`.\\*\\*\nDue to use of laziness `(==)` isn't reliable for comparing Forests.\n","args":["a"],"type":"Lazy.LList.LList (Lazy.Tree.Tree a)"}],"values":[{"name":"andMap","comment":" Chain map operations.\n\n    import Lazy.LList as LL\n    import Tuple\n\n    Tree Tuple.pair (LL.fromList [ singleton Tuple.pair, singleton Tuple.pair, singleton Tuple.pair ])\n        |> andMap (Tree 1 <| LL.fromList [ singleton 2, singleton 3, singleton 4 ])\n        |> andMap (Tree 5 <| LL.fromList [ singleton 6, singleton 7 ])\n        |> children\n    --> [ (2, 6), (3, 7) ]\n\n","type":"Lazy.Tree.Tree a -> Lazy.Tree.Tree (a -> b) -> Lazy.Tree.Tree b"},{"name":"andThen","comment":" Map given function onto a `Tree` and flatten the result.\n\n    import Lazy.LList as LL\n\n    singleton \"foo\"\n        |> insert (singleton \"bar\")\n        |> insert (singleton \"baz\")\n        |> andThen (\\a -> Tree a <| LL.fromList [ singleton <| a ++ \" fighter\" ])\n        |> children\n    --> [ \"bar\", \"baz\", \"foo fighter\" ]\n\n","type":"(a -> Lazy.Tree.Tree b) -> Lazy.Tree.Tree a -> Lazy.Tree.Tree b"},{"name":"build","comment":" Build `Tree` using custom constructor.\n\nThis can be for instance used to build `Tree` from other recursive data structure:\n\n    type Item = Item String (List Item)\n\n    getChildren (Item _ children) = children\n\n    Item \"foo\" [ Item \"bar\" [], Item \"baz\" []]\n        |> build getChildren\n        |> children\n    -> [ Item \"bar\" [], Item \"baz\" [] ]\n\nOr lookups to some other data structure.\n\n    import Dict exposing (Dict)\n\n    rootItem : String\n    rootItem = \"foo\"\n\n    childrenDict : Dict String (List String)\n    childrenDict = Dict.fromList [ (\"foo\", [ \"bar\", \"baz\" ]) ]\n\n    build (\\i -> Maybe.withDefault [] <| Dict.get i childrenDict) rootItem\n        |> children\n    --> [ \"bar\", \"baz\" ]\n\n","type":"(a -> List.List a) -> a -> Lazy.Tree.Tree a"},{"name":"children","comment":" Obtain children items of `Tree`.\n\n    singleton \"foo\"\n        |> insert (singleton \"bar\")\n        |> insert (singleton \"baz\")\n        |> children\n    --> [ \"bar\", \"baz\" ]\n\n","type":"Lazy.Tree.Tree a -> List.List a"},{"name":"descendants","comment":" Obtain descendants as `Forest` from the `Tree`.\n\n    import Lazy.LList as LL\n\n    singleton \"foo\"\n        |> insert (singleton \"bar\")\n        |> insert (singleton \"baz\")\n        |> descendants\n        |> LL.map item\n        |> LL.toList\n    --> [ \"bar\", \"baz\" ]\n\n    singleton \"foo\"\n        |> insert (singleton \"bar\" |> insert (singleton \"baz\"))\n        |> descendants\n        |> LL.map (children)\n        |> LL.toList\n    --> [ [ \"baz\" ] ]\n\n","type":"Lazy.Tree.Tree a -> Lazy.Tree.Forest a"},{"name":"duplicate","comment":" Duplicates Tree (Comonad)\n","type":"Lazy.Tree.Tree a -> Lazy.Tree.Tree (Lazy.Tree.Tree a)"},{"name":"extend","comment":" Extend tree (Comonad)\n","type":"(Lazy.Tree.Tree a -> b) -> Lazy.Tree.Tree a -> Lazy.Tree.Tree b"},{"name":"filter","comment":" Filter `Tree` children by given function.\n\nThis function goes from children of root downwards.\nThis means that nodes that don't satisfy predicate\nare excluded and filter is never performed over their children\neven if on those it might pass.\n\n    import Lazy.LList as LL\n\n    Tree 1 (LL.fromList [ singleton 2, singleton 3, singleton 4 ])\n        |> filter ((>) 4)\n        |> children\n    --> [ 2, 3 ]\n\n    Tree 1 (LL.fromList [ insert (singleton 5) <| singleton 2, insert (singleton 6) <| singleton 3, singleton 4 ])\n        |> filter ((<) 2)\n        |> descendants\n        |> LL.map children\n        |> LL.toList\n    --> [ [ 6 ], [] ]\n\n","type":"(a -> Basics.Bool) -> Lazy.Tree.Tree a -> Lazy.Tree.Tree a"},{"name":"filterMap","comment":" FilterMap on `Tree`. Works similarly to `List.filterMap` with the same properties as [filter](#filter).\nIn case of `filterMap` even root node has to satisfy predicate otherwise\n`Nothing` is returned.\n\n    import Lazy.LList as LL\n\n    Tree 1 (LL.fromList [ singleton 2, singleton 3, singleton 4 ])\n        |> filterMap (\\a -> if a < 4 then Just (a * 2) else Nothing)\n        |> Maybe.map children\n    --> Just [ 4, 6 ]\n\n    Tree 1 (LL.fromList [ singleton 2, singleton 3, singleton 4 ])\n        |> filterMap (\\a -> if a > 2 then Just (a * 2) else Nothing)\n        |> Maybe.map children\n    --> Nothing\n\n","type":"(a -> Maybe.Maybe b) -> Lazy.Tree.Tree a -> Maybe.Maybe (Lazy.Tree.Tree b)"},{"name":"flatten","comment":" Flatten `Tree` of Trees.\n\n    singleton (singleton 1)\n        |> flatten\n        |> item\n    --> 1\n\n    import Lazy.LList as LL\n\n    Tree (Tree \"foo\" <| LL.fromList [ singleton \"bar\"]) (LL.fromList [ singleton <| singleton \"baz\" ])\n        |> flatten\n        |> children\n    --> [ \"baz\", \"bar\" ]\n\n","type":"Lazy.Tree.Tree (Lazy.Tree.Tree a) -> Lazy.Tree.Tree a"},{"name":"forestMap","comment":" Map function over `Forest`.\n\n    import Lazy.LList as LL\n\n    [ 1, 2, 3 ]\n        |> fromList (\\m _ -> m == Nothing)\n        |> forestMap ((+) 1)\n        |> LL.map item\n        |> LL.toList\n    --> [ 2, 3, 4 ]\n\n","type":"(a -> b) -> Lazy.Tree.Forest a -> Lazy.Tree.Forest b"},{"name":"forestMap2","comment":" Map function over two `Forest`s.\n\n    import Lazy.LList as LL\n\n    [ 1, 2, 3 ]\n        |> fromList (\\m _ -> m == Nothing)\n        |> forestMap2 (+) (fromList (\\m _ -> m == Nothing) [1, 2])\n        |> LL.map item\n        |> LL.toList\n    --> [ 2, 4 ]\n\n","type":"(a -> b -> c) -> Lazy.Tree.Forest a -> Lazy.Tree.Forest b -> Lazy.Tree.Forest c"},{"name":"fromKeyedList","comment":" Construct `Forest` from a list of items that can be **uniquely identified** by comparable value.\n\nThis function can yield much better performance than more general [`fromList`](#fromList) alternative.\nBe aware that this function pushes **more work on initial construction of the Tree** at the benefit of\ndoing more optimal operations during evaluation of the Tree at later time.\n\n    import Lazy.LList as LL\n\n    [ { id = 1, parent = Nothing }\n    , { id = 2, parent = Nothing }\n    , { id = 3, parent = Just 1 }\n    ]\n        |> fromKeyedList .id (Maybe.withDefault [] << Maybe.map List.singleton << .parent)\n        |> LL.map (.id << item)\n        |> LL.toList\n    --> [ 1, 2 ]\n\n    [ { id = 1, parent = Nothing }\n    , { id = 2, parent = Nothing }\n    , { id = 3, parent = Just 1 }\n    , { id = 4, parent = Just 1 }\n    , { id = 5, parent = Just 2 }\n    ]\n        |> fromList (\\p i -> Maybe.map .id p == i.parent)\n        |> LL.andThen descendants\n        |> LL.map (.id << item)\n        |> LL.toList\n    --> [ 3, 4, 5 ]\n\n","type":"(a -> comparable) -> (a -> List.List comparable) -> List.List a -> Lazy.Tree.Forest a"},{"name":"fromList","comment":" Construct `Forest` from a list.\n\n    import Lazy.LList as LL\n\n    [ { id = 1, parent = Nothing }\n    , { id = 2, parent = Nothing }\n    , { id = 3, parent = Just 1 }\n    ]\n        |> fromList (\\p i -> Maybe.map .id p == i.parent)\n        |> LL.map (.id << item)\n        |> LL.toList\n    --> [ 1, 2 ]\n\n    [ { id = 1, parent = Nothing }\n    , { id = 2, parent = Nothing }\n    , { id = 3, parent = Just 1 }\n    , { id = 4, parent = Just 1 }\n    , { id = 5, parent = Just 2 }\n    ]\n        |> fromList (\\p i -> Maybe.map .id p == i.parent)\n        |> LL.andThen descendants\n        |> LL.map (.id << item)\n        |> LL.toList\n    --> [ 3, 4, 5 ]\n\n","type":"(Maybe.Maybe a -> a -> Basics.Bool) -> List.List a -> Lazy.Tree.Forest a"},{"name":"insert","comment":" Insert one `Tree` as children another.\n\n    singleton 1\n        |> insert (singleton 2)\n        |> insert (singleton 3)\n        |> children\n    --> [ 2, 3 ]\n\n    singleton 1\n        |> insert (singleton 2)\n        |> item\n    --> 1\n\n","type":"Lazy.Tree.Tree a -> Lazy.Tree.Tree a -> Lazy.Tree.Tree a"},{"name":"isEmpty","comment":" Check if `Tree` doesn't have any child.\n\n    singleton \"foo\"\n        |> isEmpty\n    --> True\n\n    singleton \"foo\"\n        |> insert (singleton \"bar\")\n        |> isEmpty\n    --> False\n\n","type":"Lazy.Tree.Tree a -> Basics.Bool"},{"name":"item","comment":" Obtain item from `Tree`.\n\n    singleton \"foo\"\n        |> item\n        |> \"foo\"\n\n","type":"Lazy.Tree.Tree a -> a"},{"name":"map","comment":" Map function over `Tree`.\n\n    singleton 1\n        |> map ((+) 1)\n        |> item\n    --> 2\n\n    singleton 1\n        |> insert (singleton 2)\n        |> insert (singleton 3)\n        |> map ((*) 2)\n        |> children\n    --> [ 4, 6 ]\n\n","type":"(a -> b) -> Lazy.Tree.Tree a -> Lazy.Tree.Tree b"},{"name":"map2","comment":" Map function over two `Tree`s\n\n    map2 (+) (singleton 1) (singleton 5)\n        |> item\n    --> 6\n\n    import Lazy.LList as LL\n\n    Tree 1 (LL.fromList [ singleton 2, singleton 3, singleton 4 ])\n        |> map2 (+) (Tree 5 <| LL.fromList [ singleton 6, singleton 7 ])\n        |> children\n    --> [ 8, 10 ]\n\n","type":"(a -> b -> c) -> Lazy.Tree.Tree a -> Lazy.Tree.Tree b -> Lazy.Tree.Tree c"},{"name":"singleton","comment":" Puts value in minimal `Tree` context\n\n    singleton \"foo\"\n        |> item\n    --> \"foo\"\n\n","type":"a -> Lazy.Tree.Tree a"},{"name":"sort","comment":" Sort `Tree`.\n\n    singleton 10\n        |> insert (singleton 5)\n        |> insert (singleton 2)\n        |> sort\n        |> children\n    --> [ 2, 5 ]\n\nit applies to all levels:\n\n    import Lazy.LList as LL\n\n    singleton 10\n        |> insert (Tree 20 <| LL.llist (List.reverse << List.map singleton << List.range 1) 5)\n        |> sort\n        |> descendants\n        |> LL.map children\n        |> LL.toList\n    --> [ [ 1, 2, 3, 4, 5 ] ]\n\n","type":"Lazy.Tree.Tree comparable -> Lazy.Tree.Tree comparable"},{"name":"sortBy","comment":" Sort `Tree` by a function.\n\n    singleton { val = 10 }\n       |> insert (singleton { val = 7 })\n       |> insert (singleton { val = 3 })\n       |> sortBy .val\n       |> children\n    --> [ { val = 3 }, { val = 7 } ]\n\nit applies to all levels:\n\n    import Lazy.LList as LL\n\n    singleton { a = 10 }\n        |> insert (Tree { a = 20 } <| LL.llist (List.reverse << List.map (\\v -> singleton { a = v }) << List.range 1) 3)\n        |> sortBy .a\n        |> descendants\n        |> LL.map children\n        |> LL.toList\n    --> [ [ { a = 1 }, { a = 2 }, { a = 3 } ] ]\n\n","type":"(a -> comparable) -> Lazy.Tree.Tree a -> Lazy.Tree.Tree a"},{"name":"sortWith","comment":" Sort `Tree` using custom comparison\n\n    flippedComparison : comparable -> comparable -> Order\n    flippedComparison a b =\n        case Basics.compare a b of\n            LT -> GT\n            EQ -> EQ\n            GT -> LT\n\n    singleton 10\n        |> insert (singleton 2)\n        |> insert (singleton 5)\n        |> sortWith flippedComparison\n        |> children\n    --> [ 5, 2 ]\n\n","type":"(a -> a -> Basics.Order) -> Lazy.Tree.Tree a -> Lazy.Tree.Tree a"},{"name":"stableSortWith","comment":" Stable sort `Tree` using custom comparison.\nThe original order is guaranteed to be kept if the comparison returns `EQ`.\n\n    compareAge : { r | age : comparable } -> { r | age : comparable } -> Order\n    compareAge a b =\n        Basics.compare a.age b.age\n\n    singleton { name = \"Eve\", age = 55 }\n        |> insert (singleton { name = \"Joe\", age = 25 })\n        |> insert (singleton { name = \"Sue\", age = 25 })\n        |> insert (singleton { name = \"Johann\", age = 23 })\n        |> stableSortWith compareAge\n        |> children\n    --> [ { name = \"Johann\", age = 23 }, { name = \"Joe\", age = 25 }, { name = \"Sue\", age = 25 } ]\n\n","type":"(a -> a -> Basics.Order) -> Lazy.Tree.Tree a -> Lazy.Tree.Tree a"}],"binops":[]},{"name":"Lazy.Tree.Zipper","comment":" Zipper implementation for `Lazy.Tree`.\n\n> A zipper is a technique of representing an aggregate data structure so that it is convenient\n> for writing programs that traverse the structure arbitrarily and update its contents,\n> especially in purely functional programming languages.\n\n`Zipper` is a secret sauce that gives `Tree` real power.\nIt provides an easy way to query and modify the `Tree` in a clever and very flexible way.\n\nTypes within this module are exposed type aliases to make it easy to extend the default functionality of `Zipper`.\n\n\n# Types\n\n@docs Breadcrumb, Zipper, fromTree\n\n\n# Query\n\n@docs current, children, isRoot, isEmpty, attempt, getTree, getPath\n\n\n# Operations\n\n@docs insert, delete, filter, update, updateItem, setTree\n\n\n# Navigation\n\n@docs root, up, upwards, toLeft, toRight, open, openAll, openPath, attemptOpenPath\n\n\n# Transformations\n\n@docs map, duplicate, extend\n\n\n# Breadcrumbs\n\n@docs breadcrumbs, indexedBreadcrumbs\n\n","unions":[{"name":"Breadcrumb","comment":" \\*\\* Be careful when comparing `Breadcrumb`s using `(==)`.\\*\\*\nDue to use of laziness `(==)` isn't reliable for comparing Breadcrumbs.\n\nBreadcrumbs are private type not meant to be manipulated directly.\nHowever it's possible to extract breadcrumbs from `Zipper` in transformed\nformat using `breadcrumbs` and `indexedBreadcrumbs` functions which are meant for public use.\n\n","args":["a"],"cases":[]},{"name":"Zipper","comment":" ","args":["a"],"cases":[["Zipper",["Lazy.Tree.Tree a","List.List (Lazy.Tree.Zipper.Breadcrumb a)"]]]}],"aliases":[],"values":[{"name":"attempt","comment":" Attempt to perform action over zipper and return original `Zipper` in cases where this action returns `Nothing`.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> attempt delete\n        |> current\n    --> \"foo\"\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\")\n        |> attempt (open ((==) \"foo\"))\n        |> attempt delete\n        |> current\n    --> \"foo\"\n\n","type":"(Lazy.Tree.Zipper.Zipper a -> Maybe.Maybe (Lazy.Tree.Zipper.Zipper a)) -> Lazy.Tree.Zipper.Zipper a -> Lazy.Tree.Zipper.Zipper a"},{"name":"attemptOpenPath","comment":" Similar to [`openPath`](#openPath) but ignore failed steps.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\")\n        |> attemptOpenPath (==) [ \"not-here\", \"bar\" ]\n        |> current\n    --> \"bar\"\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> attemptOpenPath (==) [ \"baz\" ]\n        |> current\n    --> \"foo\"\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\" |> T.insert (T.singleton \"baz\"))\n        |> attemptOpenPath (==) [ \"not-here\", \"bar\", \"missing\", \"baz\" ]\n        |> current\n    --> \"baz\"\n\n","type":"(b -> a -> Basics.Bool) -> List.List b -> Lazy.Tree.Zipper.Zipper a -> Lazy.Tree.Zipper.Zipper a"},{"name":"breadcrumbs","comment":" Get `List` of `Breadcrumb`s .\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\" |> T.insert (T.singleton \"baz\"))\n        |> attemptOpenPath (==) [ \"bar\", \"baz\" ]\n        |> breadcrumbs\n    --> [ \"bar\", \"foo\" ]\n\n","type":"Lazy.Tree.Zipper.Zipper a -> List.List a"},{"name":"children","comment":" Get children of current `Tree`.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\")\n        |> children\n    --> [ \"bar\" ]\n\n","type":"Lazy.Tree.Zipper.Zipper a -> List.List a"},{"name":"current","comment":" Get the root item of the current `Tree`.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\")\n        |> current\n    --> \"foo\"\n\n","type":"Lazy.Tree.Zipper.Zipper a -> a"},{"name":"delete","comment":" Delete current `Tree` from `Zipper`.\n\nReturns Nothing if root node is removed.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> delete\n    --> Nothing\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\")\n        |> open (always True)\n        |> Maybe.andThen delete\n        |> Maybe.map current\n    --> Just \"foo\"\n\n","type":"Lazy.Tree.Zipper.Zipper a -> Maybe.Maybe (Lazy.Tree.Zipper.Zipper a)"},{"name":"duplicate","comment":" Duplicate Zipper (Comonad).\nConverts each node into its full Zipper context.\nFor example, the [`extend`] function is defined as\n\n    extend : (Zipper a -> b) -> Zipper a -> Zipper b\n    extend f =\n        map f << duplicate\n\n","type":"Lazy.Tree.Zipper.Zipper a -> Lazy.Tree.Zipper.Zipper (Lazy.Tree.Zipper.Zipper a)"},{"name":"extend","comment":" Extend Zipper (Comonad).\nSort of like a contextful `map` where instead of mapping only each element,\nyou have access to the whole Zipper at each element's location.\nE.g.:\n\n    extendWithPath : Zipper a -> Zipper ( a, List a )\n    extendWithPath =\n        extend (\\z -> ( current z, getPath identity z ))\n\n","type":"(Lazy.Tree.Zipper.Zipper a -> b) -> Lazy.Tree.Zipper.Zipper a -> Lazy.Tree.Zipper.Zipper b"},{"name":"filter","comment":" Performs filter on current `Tree` in `Zipper`. See `Tree.filter` for more information.\n\n    import Lazy.LList as LL\n    import Lazy.Tree as T\n\n    T.Tree 1 (LL.fromList [ T.singleton 2, T.singleton 3, T.singleton 4 ])\n        |> fromTree\n        |> filter ((>) 4)\n        |> children\n    --> [ 2, 3 ]\n\n    T.Tree 1 (LL.fromList [ T.singleton 2, T.singleton 3, T.singleton 4 ])\n        |> fromTree\n        |> attempt (open ((==) 1))\n        |> filter ((<) 2)\n        |> root\n        |> children\n    --> [ 3, 4 ]\n\n    T.Tree 1 (LL.fromList [ T.insert (T.singleton 5) <| T.singleton 2, T.insert (T.singleton 6) <| T.singleton 3, T.singleton 4 ])\n        |> fromTree\n        |> attempt (open ((==) 1))\n        |> filter ((<) 2)\n        |> getTree\n        |> T.descendants\n        |> LL.andThen (LL.map T.item << T.descendants)\n        |> LL.toList\n    --> [ 6 ]\n\n","type":"(a -> Basics.Bool) -> Lazy.Tree.Zipper.Zipper a -> Lazy.Tree.Zipper.Zipper a"},{"name":"fromTree","comment":" Init `Zipper` for `Tree`.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> current\n    --> \"foo\"\n\n","type":"Lazy.Tree.Tree a -> Lazy.Tree.Zipper.Zipper a"},{"name":"getPath","comment":" Use given function to convert current breadcrumb path to a list\n\nResulting list of breadcrumbs contains currently focused item as well.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\")\n        |> attemptOpenPath (==) [ \"bar\" ]\n        |> getPath identity\n    --> [ \"foo\", \"bar\" ]\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\" |> T.insert (T.singleton \"baz\") )\n        |> attemptOpenPath (==) [ \"bar\", \"baz\" ]\n        |> getPath identity\n    --> [ \"foo\", \"bar\", \"baz\" ]\n\n","type":"(a -> b) -> Lazy.Tree.Zipper.Zipper a -> List.List b"},{"name":"getTree","comment":" Extract current `Tree` from a `Zipper`.\n\nuseful in case where you don't want to use pattern matching\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> getTree\n        |> T.item\n    --> \"foo\"\n\n","type":"Lazy.Tree.Zipper.Zipper a -> Lazy.Tree.Tree a"},{"name":"indexedBreadcrumbs","comment":" Get `Breadcrumb`s as indexed `List`.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\" |> T.insert (T.singleton \"baz\"))\n        |> attemptOpenPath (==) [ \"bar\", \"baz\" ]\n        |> indexedBreadcrumbs\n    --> [ ( 1, \"bar\" ), ( 2, \"foo\" )]\n\n","type":"Lazy.Tree.Zipper.Zipper a -> List.List ( Basics.Int, a )"},{"name":"insert","comment":" Insert sub `Tree` into current `Tree` in `Zipper`.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\")\n        |> insert (T.singleton \"baz\")\n        |> children\n    --> [ \"bar\", \"baz\" ]\n\n","type":"Lazy.Tree.Tree a -> Lazy.Tree.Zipper.Zipper a -> Lazy.Tree.Zipper.Zipper a"},{"name":"isEmpty","comment":" Check if current `Tree` in `Zipper` is empty.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> isEmpty\n    --> True\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\")\n        |> isEmpty\n    --> False\n\n","type":"Lazy.Tree.Zipper.Zipper a -> Basics.Bool"},{"name":"isRoot","comment":" Check if `Zipper` is focused on the root `Tree`.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n       |> fromTree\n       |> isRoot\n    --> True\n\n","type":"Lazy.Tree.Zipper.Zipper a -> Basics.Bool"},{"name":"map","comment":" Map function over `Zipper`.\n\n    import Lazy.Tree as T\n\n    T.singleton 1\n        |> fromTree\n        |> map ((+) 1)\n        |> current\n    --> 2\n\n","type":"(a -> b) -> Lazy.Tree.Zipper.Zipper a -> Lazy.Tree.Zipper.Zipper b"},{"name":"open","comment":" Open the first child that satisfies given condition.\nIf there is no child satisfying the condition, returns Nothing.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\")\n        |> open ((==) \"bar\")\n        |> Maybe.map current\n    --> Just \"bar\"\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\" |> T.insert (T.singleton \"baz\") )\n        |> attempt (open ((==) \"bar\"))\n        |> attempt (open ((==) \"baz\"))\n        |> current\n    --> \"baz\"\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> open (always True)\n    --> Nothing\n\n","type":"(a -> Basics.Bool) -> Lazy.Tree.Zipper.Zipper a -> Maybe.Maybe (Lazy.Tree.Zipper.Zipper a)"},{"name":"openAll","comment":" Get `List` of `Zipper`s for all children of current `Zipper`\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\")\n        |> insert (T.singleton \"baz\")\n        |> openAll\n        |> List.map current\n    --> [ \"bar\", \"baz\" ]\n\n","type":"Lazy.Tree.Zipper.Zipper a -> List.List (Lazy.Tree.Zipper.Zipper a)"},{"name":"openPath","comment":" Open multiple levels reducing list by given function.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\" |> T.insert (T.singleton \"baz\") )\n        |> openPath (==) [ \"bar\", \"baz\" ]\n        |> Result.map current\n    --> Ok \"baz\"\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\")\n        |> openPath (==) [ \"not-here\", \"baz\" ]\n        |> Result.map current\n    --> Err \"Can't resolve open\"\n\n","type":"(b -> a -> Basics.Bool) -> List.List b -> Lazy.Tree.Zipper.Zipper a -> Result.Result String.String (Lazy.Tree.Zipper.Zipper a)"},{"name":"root","comment":" Navigate back to the root `Tree`.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\" |> T.insert (T.singleton \"baz\") )\n        |> open ((==) \"bar\")\n        |> Maybe.andThen (open ((==) \"baz\"))\n        |> Maybe.map root\n        |> Maybe.map current\n    --> Just \"foo\"\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> root\n        |> current\n    --> \"foo\"\n\n","type":"Lazy.Tree.Zipper.Zipper a -> Lazy.Tree.Zipper.Zipper a"},{"name":"setTree","comment":" Replace current `Tree` with new one.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> setTree (T.singleton \"bar\")\n        |> current\n    --> \"bar\"\n\n","type":"Lazy.Tree.Tree a -> Lazy.Tree.Zipper.Zipper a -> Lazy.Tree.Zipper.Zipper a"},{"name":"toLeft","comment":" Move to the immediate left sibling, if it exists.\n","type":"Lazy.Tree.Zipper.Zipper a -> Maybe.Maybe (Lazy.Tree.Zipper.Zipper a)"},{"name":"toRight","comment":" Move to the immediate right sibling, if it exists.\n","type":"Lazy.Tree.Zipper.Zipper a -> Maybe.Maybe (Lazy.Tree.Zipper.Zipper a)"},{"name":"up","comment":" Return back to parent of current `Tree` in given `Zipper`.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\")\n        |> open ((==) \"bar\")\n        |> Maybe.andThen up\n        |> Maybe.map current\n    --> Just \"foo\"\n\n    T.singleton \"baz\"\n        |> fromTree\n        |> up\n    --> Nothing\n\n","type":"Lazy.Tree.Zipper.Zipper a -> Maybe.Maybe (Lazy.Tree.Zipper.Zipper a)"},{"name":"update","comment":" Update current `Tree` using given function.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> update (T.map (\\a -> a ++ \" fighter\"))\n        |> current\n    --> \"foo fighter\"\n\n","type":"(Lazy.Tree.Tree a -> Lazy.Tree.Tree a) -> Lazy.Tree.Zipper.Zipper a -> Lazy.Tree.Zipper.Zipper a"},{"name":"updateItem","comment":" Update the root item of the current `Tree` using given function.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> updateItem (\\i -> i ++ \" fighter\")\n        |> current\n    --> \"foo fighter\"\n\n","type":"(a -> a) -> Lazy.Tree.Zipper.Zipper a -> Lazy.Tree.Zipper.Zipper a"},{"name":"upwards","comment":" Perform [`up`](#up) n times.\n\n    import Lazy.Tree as T\n\n    T.singleton \"foo\"\n        |> fromTree\n        |> insert (T.singleton \"bar\" |> T.insert (T.singleton \"baz\") )\n        |> open ((==) \"bar\")\n        |> Maybe.andThen (open ((==) \"baz\"))\n        |> Maybe.andThen (upwards 2)\n        |> Maybe.map current\n    --> Just \"foo\"\n\nReturns given `Zipper` return if `0` is passed:\n\n    T.singleton \"foo\"\n       |> fromTree\n       |> upwards 0\n       |> Maybe.map current\n    --> Just \"foo\"\n\nReturn `Nothing` if there are not enough ancestors in `Zipper`:\n\n    T.singleton 4\n        |> fromTree\n        |> upwards 1\n    --> Nothing\n\nReturn `Nothing` if negative integer is passed:\n\n    T.singleton 4\n        |> fromTree\n        |> upwards -1\n    --> Nothing\n\n","type":"Basics.Int -> Lazy.Tree.Zipper.Zipper a -> Maybe.Maybe (Lazy.Tree.Zipper.Zipper a)"}],"binops":[]}]