[{"name":"Update","comment":" Module providing a way to build scalable update function.\nIt enables you to build a complex update function by composing primitive functions.\n\n\n# Core\n\n@docs Update\n@docs run\n@docs batch\n\n\n# Primitive Updates\n\n@docs none\n@docs modify\n@docs push\n\n\n# Handle conditions\n\n@docs when\n@docs unless\n@docs whenNothing\n@docs whenJust\n@docs whenOk\n@docs whenErr\n\n\n# Handle cases\n\n@docs with\n@docs on\n@docs onNothing\n@docs onJust\n@docs onOk\n@docs onErr\n\n\n# Lower level functions\n\n@docs map\n@docs child\n@docs maybeChild\n\n","unions":[{"name":"Update","comment":" Alternative type for update function.\n\n    update : msg -> Update model msg\n\n","args":["model","msg"],"cases":[]}],"aliases":[],"values":[{"name":"batch","comment":" When you need to evaluate a couple `Update`s, you can batch them together. Each is evaluated from top to bottom.\n\n    type alias Model = { foo : String }\n\n    myUpdate : Update Model msg\n    myUpdate =\n        batch\n            [ modify (\\m -> { m | foo = m.foo ++ \"-1\" })\n            , modify (\\m -> { m | foo = m.foo ++ \"-2\" })\n            ]\n\n    run myUpdate { foo = \"bar\" }\n        |> Tuple.first\n    --> { foo = \"bar-1-2\" }\n\n","type":"List.List (Update.Update model msg) -> Update.Update model msg"},{"name":"child","comment":" Lift `Update` for a child model to one for the parent model.\n\ne.g.,\n\n    type alias Model =\n        { child1 : ChildModel\n        }\n\n    type alias ChildModel =\n        { foo : String\n        }\n\n    child1Update : Update ChildModel msg\n    child1Update =\n        Debug.todo \"Update for the `ChildModel`\"\n\n    update : Update Model msg\n    update =\n        child\n            .child1\n            (\\c model -> { model | child1 = c })\n            child1Update\n\n","type":"(b -> a) -> (a -> b -> b) -> Update.Update a msg -> Update.Update b msg"},{"name":"map","comment":" ","type":"(a -> b) -> Update.Update model a -> Update.Update model b"},{"name":"maybeChild","comment":" Same as `child` but do nothing if first argument becomes to `Nothing`.\nIt is usefull for handling page updates of SPA.\n\ne.g.,\n\n    type alias Model =\n        { page : Page\n        }\n\n    type Page\n        = Page1 Page1Model\n        | Page2 Page2Model\n\n    type alias Page1Model =\n        { foo : String\n        }\n\n    type alias Page2Model =\n        { bar : Int\n        }\n\n    page1Update : Update Page1Model msg\n    page1Update =\n        Debug.todo \"update function for `Page1`.\"\n\n    update : Update Model msg\n    update =\n        Update.with identity\n            [ \\{ page } ->\n                case page of\n                    Page1 page1 ->\n                        page1Update\n                            (\\model ->\n                                case model.page of\n                                    Page1 a ->\n                                        Just a\n\n                                    _ ->\n                                        Nothing\n                            )\n                            (\\p model ->\n                                case model.page of\n                                    Page1 _ ->\n                                        { model | page = Page1 p }\n\n                                    _ ->\n                                        model\n                            )\n                            page1Update\n\n                    _ ->\n                        Debug.todo \"\"\n            ]\n\n","type":"(b -> Maybe.Maybe a) -> (a -> b -> b) -> Update.Update a msg -> Update.Update b msg"},{"name":"modify","comment":" Primitive `Update` that modifies Model.\n","type":"(model -> model) -> Update.Update model msg"},{"name":"none","comment":" Do nothing.\n","type":"Update.Update model msg"},{"name":"on","comment":" Evaluate `Update` only if it matches the case.\n","type":"(a -> Basics.Bool) -> List.List (Update.Update model msg) -> a -> Update.Update model msg"},{"name":"onErr","comment":" Evaluate `Update` only if the case is `Err`.\n","type":"List.List (err -> Update.Update model msg) -> Result.Result err a -> Update.Update model msg"},{"name":"onJust","comment":" Evaluate `Update` only if the case is `Just`.\n","type":"List.List (a -> Update.Update model msg) -> Maybe.Maybe a -> Update.Update model msg"},{"name":"onNothing","comment":" Evaluate `Update` only if the case is `Nothing`.\n","type":"List.List (Update.Update model msg) -> Maybe.Maybe a -> Update.Update model msg"},{"name":"onOk","comment":" Evaluate `Update` only if the case is `Ok`.\n","type":"List.List (a -> Update.Update model msg) -> Result.Result err a -> Update.Update model msg"},{"name":"push","comment":" Primitive `Update` that pushes a `Cmd`.\n","type":"(model -> Platform.Cmd.Cmd msg) -> Update.Update model msg"},{"name":"run","comment":" Evaluate to a model-cmd pair.\n\nIt is for converting to the normal update function.\ne.g.,\n\n    main : Program flags model msg\n    main =\n        element\n            { init = init\n            , view = view\n            , update = Update.run << update\n            , subscriptions = subscriptions\n            }\n\n    update : msg -> Update model msg\n    update =\n        ...\n\n","type":"Update.Update model msg -> model -> ( model, Platform.Cmd.Cmd msg )"},{"name":"unless","comment":" Evaluate `Update` unless it meets the condition.\n","type":"Basics.Bool -> List.List (Update.Update model msg) -> Update.Update model msg"},{"name":"when","comment":" Evaluate `Update` only if it meets the condition.\n","type":"Basics.Bool -> List.List (Update.Update model msg) -> Update.Update model msg"},{"name":"whenErr","comment":" Evaluate `Update` only if the first argument value is `Err`.\n","type":"Result.Result err a -> List.List (err -> Update.Update model msg) -> Update.Update model msg"},{"name":"whenJust","comment":" Evaluate `Update` only if the first argument value is `Just`.\n","type":"Maybe.Maybe a -> List.List (a -> Update.Update model msg) -> Update.Update model msg"},{"name":"whenNothing","comment":" Evaluate `Update` only if the first argument value is `Nothing`.\n","type":"Maybe.Maybe a -> List.List (Update.Update model msg) -> Update.Update model msg"},{"name":"whenOk","comment":" Evaluate `Update` only if the first argument value is `Ok`.\n","type":"Result.Result err a -> List.List (a -> Update.Update model msg) -> Update.Update model msg"},{"name":"with","comment":" Branch the update process according to the situation.\n\n    type alias Model =\n        { foo : String\n        , bar : Maybe Int\n        }\n\n    updateWithFoo : Update Model msg\n    updateWithFoo =\n        with .foo\n            [ on String.isEmpty\n                [ Update.modify <| \\model ->\n                    { model | foo = \"empty\" }\n                ]\n            ]\n\n    updateWithBar : Update Model msg\n    updateWithBar =\n        with .bar\n            [ onJust\n                [ \\n -> Update.modify <| \\model ->\n                    { model | foo = String.fromInt n }\n                ]\n            ]\n\n\n    run updateWithFoo\n        { foo = \"\"\n        , bar = Nothing\n        }\n            |> Tuple.first\n    --> { foo = \"empty\", bar = Nothing }\n\n    run updateWithFoo\n        { foo = \"foo\"\n        , bar = Nothing\n        }\n            |> Tuple.first\n    --> { foo = \"foo\", bar = Nothing }\n\n    run updateWithBar\n        { foo = \"foo\"\n        , bar = Just 4\n        }\n            |> Tuple.first\n    --> { foo = \"4\", bar = Just 4 }\n\n","type":"(model -> a) -> List.List (a -> Update.Update model msg) -> Update.Update model msg"}],"binops":[]}]