[{"name":"Fold","comment":" This module provides a type [`Fold`](#Fold) for left folds, which can be\ncombined using [`map2`](#map2) (or, more generally, [`succeed`](#succeed) and\n[`andMap`](#andMap) in pipeline style):\n\n    average : Fold Float Float\n    average =\n        map2 (/) sum length\n\nA `Fold` can be used to fold a list ([`foldList`](#foldList)) or to scan a list\n([`scanList`](#scanList)):\n\n    finalAverage : Float\n    finalAverage =\n        foldList [ 1, 2, 3 ] average\n\n    movingAverage : List Float\n    movingAverage =\n        scanList [ 1, 2, 3 ] average\n\nThis library is based on the [`foldl`][foldl] library by Gabriella Gonzalez.\n\n[foldl]: http://hackage.haskell.org/package/foldl\n\n\n# Type\n\n@docs Fold\n\n\n# Constructors\n\n@docs unfoldFold, unfoldFold_, succeed\n\n\n# Destructors\n\n@docs foldList, scanList, stepFold\n\n\n# Common folds\n\n@docs head, last, null, length\n@docs and, or, all, any\n@docs sum, product\n@docs maximum, minimum\n\n\n# Statistical folds\n\nNumerically stable single-pass statistics, computed via\n[Welford's online algorithm][welford]. All return `Maybe` to keep the empty\n(and, for sample-based folds, singleton) cases honest.\n\n[welford]: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm\n\n@docs average\n@docs mean, variance, standardDeviation\n@docs sampleVariance, sampleStandardDeviation\n\n\n# Membership\n\n@docs elem, notElem\n\n\n# Combinators\n\n@docs map, map2, map3, map4, map5, map6, andMap\n@docs extend\n@docs groupBy, prefilter, premap\n@docs distributed\n\n","unions":[{"name":"Fold","comment":" A left fold, which takes zero or more values of type `a` as input and\nproduces output of type `b`.\n","args":["a","b"],"cases":[]}],"aliases":[],"values":[{"name":"all","comment":" A `Fold` which tests if _all_ of its inputs satisfy some predicate.\n","type":"(a -> Basics.Bool) -> Fold.Fold a Basics.Bool"},{"name":"and","comment":" A `Fold` which tests if _all_ of its inputs were true.\n","type":"Fold.Fold Basics.Bool Basics.Bool"},{"name":"andMap","comment":" Chain a `Fold` producing a function onto a `Fold` producing its argument.\nDesigned for pipeline style, when [`map2`](#map2)–[`map6`](#map6) aren't enough:\n\n    succeed (\\a b c -> ( a, b, c ))\n        |> andMap foldA\n        |> andMap foldB\n        |> andMap foldC\n\n","type":"Fold.Fold a x -> Fold.Fold a (x -> y) -> Fold.Fold a y"},{"name":"any","comment":" A `Fold` which tests if _any_ of its inputs satisfy some predicate.\n","type":"(a -> Basics.Bool) -> Fold.Fold a Basics.Bool"},{"name":"average","comment":" A `Fold` which computes the arithmetic mean as `sum / length`. Returns\n`NaN` for the empty list.\n\nCompared to [`mean`](#mean), this commits to a single final division and so\nis slightly more accurate on well-scaled inputs — but `sum` can overflow to\n`Infinity` when many large values are combined. Prefer [`mean`](#mean) when\nyou also need a [`variance`](#variance) (the state is shared via `map2`), or\nwhen overflow is a concern, or when you want `Maybe` semantics on empty\ninput.\n\n    average : Fold Float Float\n    average =\n        map2 (/) sum length\n\n","type":"Fold.Fold Basics.Float Basics.Float"},{"name":"distributed","comment":" Lift a `Fold` so it consumes a stream of functions `e -> a` and produces a\nfunction `e -> b`. At every point `e`, the resulting function is the value the\noriginal fold would have produced from the stream of `a`s obtained by applying\neach input function to `e`.\n\n    foldList [ \\e -> e + 1, \\e -> e * 2, \\e -> e - 3 ] (distributed sum) 10\n    --> 38  -- == 11 + 20 + 7\n\n","type":"Fold.Fold a b -> Fold.Fold (e -> a) (e -> b)"},{"name":"elem","comment":" A `Fold` which tests if a specific value appeared as an input.\n","type":"a -> Fold.Fold a Basics.Bool"},{"name":"extend","comment":" The comonadic extend operation. Given a function that turns a `Fold` into\nan output, produce a `Fold` that emits that output at every step, taking into\naccount all input seen so far.\n","type":"(Fold.Fold a b -> c) -> Fold.Fold a b -> Fold.Fold a c"},{"name":"foldList","comment":" Run a `Fold` on a list of inputs, and then generate a single output. This\nis analogous to [`List.foldl`](https://package.elm-lang.org/packages/elm/core/latest/List#foldl).\n","type":"List.List a -> Fold.Fold a b -> b"},{"name":"groupBy","comment":" Perform a `Fold` while grouping the data according to a specified group\nprojection function. Returns the folded result grouped as a `Dict` keyed by\nthe group.\n","type":"(a -> comparable) -> Fold.Fold a r -> Fold.Fold a (Dict.Dict comparable r)"},{"name":"head","comment":" A `Fold` which remembers the first input.\n","type":"Fold.Fold a (Maybe.Maybe a)"},{"name":"last","comment":" A `Fold` which keeps the last input.\n","type":"Fold.Fold a (Maybe.Maybe a)"},{"name":"length","comment":" A `Fold` which counts its inputs.\n","type":"Fold.Fold a number"},{"name":"map","comment":" Transform the output of a `Fold`.\n","type":"(b -> c) -> Fold.Fold a b -> Fold.Fold a c"},{"name":"map2","comment":" Combine the results of two `Fold`s run in parallel over the same input.\n\n    average : Fold Float Float\n    average =\n        map2 (/) sum length\n\n","type":"(b -> c -> d) -> Fold.Fold a b -> Fold.Fold a c -> Fold.Fold a d"},{"name":"map3","comment":" Combine the results of three `Fold`s run in parallel over the same input.\n","type":"(b -> c -> d -> e) -> Fold.Fold a b -> Fold.Fold a c -> Fold.Fold a d -> Fold.Fold a e"},{"name":"map4","comment":" Combine the results of four `Fold`s run in parallel over the same input.\n","type":"(b -> c -> d -> e -> g) -> Fold.Fold a b -> Fold.Fold a c -> Fold.Fold a d -> Fold.Fold a e -> Fold.Fold a g"},{"name":"map5","comment":" Combine the results of five `Fold`s run in parallel over the same input.\n","type":"(b -> c -> d -> e -> g -> h) -> Fold.Fold a b -> Fold.Fold a c -> Fold.Fold a d -> Fold.Fold a e -> Fold.Fold a g -> Fold.Fold a h"},{"name":"map6","comment":" Combine the results of six `Fold`s run in parallel over the same input.\n","type":"(b -> c -> d -> e -> g -> h -> i) -> Fold.Fold a b -> Fold.Fold a c -> Fold.Fold a d -> Fold.Fold a e -> Fold.Fold a g -> Fold.Fold a h -> Fold.Fold a i"},{"name":"maximum","comment":" A `Fold` which computes the maximum of its inputs, or `Nothing` if there\nwere no inputs.\n","type":"Fold.Fold comparable (Maybe.Maybe comparable)"},{"name":"mean","comment":" A `Fold` which computes the arithmetic mean of its inputs via Welford's\nonline algorithm, or `Nothing` if there were no inputs.\n\nThe running mean stays bounded by the data's range (so it never overflows)\nand shares state with [`variance`](#variance) and friends when combined via\n`map2`. For a one-shot mean of well-scaled data, [`average`](#average) is\nsimpler and slightly more accurate.\n\n","type":"Fold.Fold Basics.Float (Maybe.Maybe Basics.Float)"},{"name":"minimum","comment":" A `Fold` which computes the minimum of its inputs, or `Nothing` if there\nwere no inputs.\n","type":"Fold.Fold comparable (Maybe.Maybe comparable)"},{"name":"notElem","comment":" A `Fold` which tests if a specific value did not appear as an input.\n","type":"a -> Fold.Fold a Basics.Bool"},{"name":"null","comment":" A `Fold` which tests whether any inputs were seen.\n","type":"Fold.Fold a Basics.Bool"},{"name":"or","comment":" A `Fold` which tests if _any_ of its inputs were true.\n","type":"Fold.Fold Basics.Bool Basics.Bool"},{"name":"prefilter","comment":" `prefilter pred f` returns a new `Fold` based on `f` but where inputs will\nonly be included if they satisfy the predicate `pred`.\n","type":"(a -> Basics.Bool) -> Fold.Fold a b -> Fold.Fold a b"},{"name":"premap","comment":" `premap f fold` returns a new `Fold` which applies `f` to each input\nbefore handing it to `fold`. This is the contravariant map on the input side\n(compare with [`map`](#map), which transforms the output).\n\n    sumOfSquares : Fold Float Float\n    sumOfSquares =\n        premap (\\x -> x * x) sum\n\n","type":"(a -> b) -> Fold.Fold b r -> Fold.Fold a r"},{"name":"product","comment":" A `Fold` which computes the product of its inputs.\n","type":"Fold.Fold number number"},{"name":"sampleStandardDeviation","comment":" A `Fold` which computes the sample standard deviation of its inputs, or\n`Nothing` if fewer than two inputs were seen.\n","type":"Fold.Fold Basics.Float (Maybe.Maybe Basics.Float)"},{"name":"sampleVariance","comment":" A `Fold` which computes the sample (Bessel-corrected, `n - 1`) variance of\nits inputs, or `Nothing` if fewer than two inputs were seen.\n","type":"Fold.Fold Basics.Float (Maybe.Maybe Basics.Float)"},{"name":"scanList","comment":" Run a `Fold` on a list of inputs, generating an output for each input.\n","type":"List.List a -> Fold.Fold a b -> List.List b"},{"name":"standardDeviation","comment":" A `Fold` which computes the population standard deviation of its inputs,\nor `Nothing` if there were no inputs.\n","type":"Fold.Fold Basics.Float (Maybe.Maybe Basics.Float)"},{"name":"stepFold","comment":" Step a fold by providing a single input.\n","type":"a -> Fold.Fold a b -> Fold.Fold a b"},{"name":"succeed","comment":" A `Fold` which ignores its input and always produces the given value.\n\nThis is useful as the starting point of an [`andMap`](#andMap) pipeline.\n\n","type":"b -> Fold.Fold a b"},{"name":"sum","comment":" A `Fold` which computes the sum of its inputs.\n","type":"Fold.Fold number number"},{"name":"unfoldFold","comment":" Create a `Fold` by providing an initial state, a function which updates\nthat state, and a function which produces output from a state.\n","type":"s -> (a -> s -> s) -> (s -> b) -> Fold.Fold a b"},{"name":"unfoldFold_","comment":" Create a `Fold` by providing an initial state and a function which updates\nthat state. This is a variant of [`unfoldFold`](#unfoldFold) where the output\nis the state itself.\n","type":"b -> (a -> b -> b) -> Fold.Fold a b"},{"name":"variance","comment":" A `Fold` which computes the population variance of its inputs, or\n`Nothing` if there were no inputs. For a singleton input the variance is `0`.\n","type":"Fold.Fold Basics.Float (Maybe.Maybe Basics.Float)"}],"binops":[]}]