[{"name":"Initialization","comment":" This module provides a simplified way to separate the initialization process of an application,\nwhere random values have not yet been generated, HTTP responses have not yet arrived, and so on.\n\nBy using this module, you can define two model types:\none that exists only during the initialization phase,\nand another that exists only during the running phase.\nThis helps you avoid flooding your model with `Maybe` values\nthat are needed only to represent the absence of data during initialization.\n\n  - If you use `elm make --debug` and\n    need more detailed information during the initializing phase,\n    check out the `Initialization.Debuggable` module.\n  - If you find these functionalities too restricted,\n    check the `Initialization.Advanced` module for more control.\n\n\n# Type\n\n@docs Program\n\n\n# Functions\n\n@docs element, document\n\n\n# Helper\n\n@docs accumulate\n\n","unions":[],"aliases":[{"name":"Program","comment":" A type alias for `Platform.Program flag <internally defined model type> <internally defined msg type>`.\n\nThis type is intended to be used in the type annotation of the `main` function.\n\n","args":["flag","initializingModel","runningModel","msg"],"type":"Initialization.Advanced.Program flag initializingModel (initializingModel -> initializingModel) runningModel msg"}],"values":[{"name":"accumulate","comment":" An applicative-style helper that accumulates blocking reasons.\n\n    toRunning : { mTimezone : Maybe Time.Zone, mPosixTime : Maybe Time.Posix } -> Result (List String) ( { timezone : Time.Zone, posixTime : Time.Posix }, Cmd msg )\n    toRunning { mTimezone, mPosixTime } =\n        Ok (\\timezone posixTime -> { timezone = timezone, posixTime = posixTime })\n            |> accumulate (Result.fromMaybe \"No timezone\" mTimezone)\n            |> accumulate (Result.fromMaybe \"No posix time\" mPosixTime)\n\n","type":"Result.Result blockingReason a -> Result.Result (List.List blockingReason) (a -> b) -> Result.Result (List.List blockingReason) b"},{"name":"document","comment":" Similar to `Browser.document`, but with more flexibility during the initialization process.\n\nIn the first argument record, you define the initialization phase with its own model type,\n`initializingModel`.\nThe `Cmd (initializingModel -> initializingModel)` value returned from the function assigned\nto the `init` field describes how `initializingModel` values should be transformed\nby effectful commands.\n(Use `Cmd.batch` to execute multiple commands. Note that their execution order is not guaranteed.)\n\n`toRunning` is called every time `initializingModel` is updated.\nIf it returns `Ok ( runningModel, runningMsgCmd )`,\nthe initialization phase ends immediately,\nand the running phase defined by the second argument record begins,\nas if `( runningModel, runningMsgCmd )` were returned from the `init` function\nof a normal `Browser.document`.\n\nWith `blockingReason` values,\nyou can represent why the initialization phase is still in progress\nand the running phase has not yet started.\nFor simple use cases, the `blockingReason` type can just be `String`,\nbut you may also use a custom type to represent richer, structured reasons.\nThese values are returned by `toRunning` when it fails to convert\n`initializingModel` into `( runningModel, Cmd runningMsg )`,\nand are passed to `initView` so that you can display the current state\nto users of your web application.\n\n⚠️ If `toRunning` returns `Ok _`, the initialization phase ends immediately,\nand any remaining `Cmd (initializingModel -> initializingModel)` values are ignored.\nBe careful not to return `Ok _` while waiting for indispensable command results,\nsuch as those from an HTTP request.\n\n  - If you find the information shown in the Elm Debugger\n    during the initializing phase insufficient,\n    consider using `Initialization.Debuggable.document` instead.\n  - If you need more advanced control over the initialization process,\n    see `Initialization.Advanced.document`, which allows:\n      - dynamic creation of `Cmd` values during the initialization phase\n      - controlling the execution order of commands, as in normal TEA applications\n\n","type":"{ init : flag -> ( initializingModel, Platform.Cmd.Cmd (initializingModel -> initializingModel) ), initView : List.List blockingReason -> initializingModel -> Browser.Document (initializingModel -> initializingModel), toRunning : initializingModel -> Result.Result (List.List blockingReason) ( model, Platform.Cmd.Cmd msg ) } -> { subscriptions : model -> Platform.Sub.Sub msg, update : msg -> model -> ( model, Platform.Cmd.Cmd msg ), view : model -> Browser.Document msg } -> Initialization.Program flag initializingModel model msg"},{"name":"element","comment":" Similar to `Browser.element`, but with more flexibility during the initialization process.\n\nIn the first argument record, you define the initialization phase with its own model type,\n`initializingModel`.\nThe `Cmd (initializingModel -> initializingModel)` value returned from the function assigned\nto the `init` field describes how `initializingModel` values should be transformed\nby effectful commands.\n(Use `Cmd.batch` to execute multiple commands. Note that their execution order is not guaranteed.)\n\n`toRunning` is called every time `initializingModel` is updated.\nIf it returns `Ok ( runningModel, runningMsgCmd )`,\nthe initialization phase ends immediately,\nand the running phase defined by the second argument record begins,\nas if `( runningModel, runningMsgCmd )` were returned from the `init` function\nof a normal `Browser.element`.\n\nWith `blockingReason` values,\nyou can represent why the initialization phase is still in progress\nand the running phase has not yet started.\nFor simple use cases, the `blockingReason` type can just be `String`,\nbut you may also use a custom type to represent richer, structured reasons.\nThese values are returned by `toRunning` when it fails to convert\n`initializingModel` into `( runningModel, Cmd runningMsg )`,\nand are passed to `initView` so that you can display the current state\nto users of your web application.\n\n⚠️ If `toRunning` returns `Ok _`, the initialization phase ends immediately,\nand any remaining `Cmd (initializingModel -> initializingModel)` values are ignored.\nBe careful not to return `Ok _` while waiting for indispensable command results,\nsuch as those from an HTTP request.\n\n  - If you find the information shown in the Elm Debugger\n    during the initializing phase insufficient,\n    consider using `Initialization.Debuggable.element` instead.\n  - If you need more advanced control over the initialization process,\n    see `Initialization.Advanced.element`, which allows:\n      - dynamic creation of `Cmd` values during the initialization phase\n      - controlling the execution order of commands, as in normal TEA applications\n\n","type":"{ init : flag -> ( initializingModel, Platform.Cmd.Cmd (initializingModel -> initializingModel) ), initView : List.List blockingReason -> initializingModel -> Html.Html (initializingModel -> initializingModel), toRunning : initializingModel -> Result.Result (List.List blockingReason) ( model, Platform.Cmd.Cmd msg ) } -> { subscriptions : model -> Platform.Sub.Sub msg, update : msg -> model -> ( model, Platform.Cmd.Cmd msg ), view : model -> Html.Html msg } -> Initialization.Program flag initializingModel model msg"}],"binops":[]},{"name":"Initialization.Advanced","comment":" This module provides whole control over the initialization process.\n\nFor most applications, the simpler `Initialization.element` API is sufficient.\nUse this module only if you need finer control over the initialization phase,\nsuch as dynamic command creation.\n\nWhat you do with this module is basically to define two independent TEA application,\none representing initializing process and the other running process,\nand to define one conversion function from initializing model to running model.\n\n\n# Type\n\n@docs Program\n\n\n# Functions\n\n@docs element, document\n\n\n# Helper\n\n@docs accumulate\n\n","unions":[],"aliases":[{"name":"Program","comment":" A type alias for `Platform.Program flag <internally defined model type> <internally defined msg type>`.\n\nThis type is intended to be used in the type annotation of the `main` function.\n\n","args":["flag","initializingModel","initializingMsg","runningModel","runningMsg"],"type":"Platform.Program flag (Initialization.Advanced.Model initializingModel runningModel) (Initialization.Advanced.Msg initializingMsg runningMsg)"}],"values":[{"name":"accumulate","comment":" An applicative-style helper that accumulates blocking reasons.\nBlocking reasons are accumulated in reverse order of application.\n\n    type alias InitializingModel =\n        { mTimezone : Maybe Time.Zone\n        , mPosixTime : Maybe Time.Posix\n        }\n\n    type alias Model =\n        { timezone : Time.Zone\n        , posixTime : Time.Posix\n        }\n\n    toRunning : InitializingModel -> Result (List String) ( Model, Cmd msg )\n    toRunning { mTimezone, mPosixTime } =\n        Ok (\\timezone posixTime -> ( { timezone = timezone, posixTime = posixTime }, Cmd.none ))\n            |> accumulate (Result.fromMaybe \"No timezone\" mTimezone)\n            |> accumulate (Result.fromMaybe \"No posix time\" mPosixTime)\n\n    toRunning (InitializingModel Nothing Nothing)\n        --> Err [\"No posix time\", \"No timezone\"]\n\n","type":"Result.Result blockingReason a -> Result.Result (List.List blockingReason) (a -> b) -> Result.Result (List.List blockingReason) b"},{"name":"document","comment":" Similar to `Browser.document`, but with more flexibility during the initialization process.\n\nIn the first argument record, you define the initialization phase in the same way as a normal TEA document.\nHere, `toRunning` is called every time `initializingModel` is updated.\nWhen it returns `Ok ( runningModel, runningMsgCmd )`, the initialization phase is terminated,\nand the running phase defined by the second argument record begins,\nas if `( runningModel, runningMsgCmd )` were returned from the `init` function\nin an ordinary `Browser.document` argument record.\n\nBy introducing the `blockingReason` type,\nyou can represent the reason why the initialization phase is still in progress\nand the running phase has not yet started.\nThis value is returned by `toRunning` when it fails to convert `initializingModel`\nto `( runningModel, Cmd runningMsg )`,\nand is used by `initView` to display the current state to users of your web application.\n\n⚠️ If `toRunning` returns `Ok _`, the initialization phase is forced to end,\nand any remaining `Cmd initializingMsg` values are ignored.\nBe careful not to return `Ok _` while waiting for command results that are indispensable for your app,\nsuch as an HTTP request.\n\n","type":"{ init : flag -> ( initializingModel, Platform.Cmd.Cmd initializingMsg ), initSubscriptions : initializingModel -> Platform.Sub.Sub initializingMsg, initUpdate : initializingMsg -> initializingModel -> ( initializingModel, Platform.Cmd.Cmd initializingMsg ), initView : List.List blockingReason -> initializingModel -> Browser.Document initializingMsg, toRunning : initializingModel -> Result.Result (List.List blockingReason) ( runningModel, Platform.Cmd.Cmd runningMsg ) } -> { subscriptions : runningModel -> Platform.Sub.Sub runningMsg, update : runningMsg -> runningModel -> ( runningModel, Platform.Cmd.Cmd runningMsg ), view : runningModel -> Browser.Document runningMsg } -> Initialization.Advanced.Program flag initializingModel initializingMsg runningModel runningMsg"},{"name":"element","comment":" Similar to `Browser.element`, but with more flexibility during the initialization process.\n\nIn the first argument record, you define the initialization phase in the same way as a normal TEA element.\nHere, `toRunning` is called every time `initializingModel` is updated.\nWhen it returns `Ok ( runningModel, runningMsgCmd )`, the initialization phase is terminated,\nand the running phase defined by the second argument record begins,\nas if `( runningModel, runningMsgCmd )` were returned from the `init` function\nin an ordinary `Browser.element` argument record.\n\nBy introducing the `blockingReason` type,\nyou can represent the reason why the initialization phase is still in progress\nand the running phase has not yet started.\nThis value is returned by `toRunning` when it fails to convert `initializingModel`\nto `( runningModel, Cmd runningMsg )`,\nand is used by `initView` to display the current state to users of your web application.\n\n⚠️ If `toRunning` returns `Ok _`, the initialization phase is forced to end,\nand any remaining `Cmd initializingMsg` values are ignored.\nBe careful not to return `Ok _` while waiting for command results that are indispensable for your app,\nsuch as an HTTP request.\n\n","type":"{ init : flag -> ( initializingModel, Platform.Cmd.Cmd initializingMsg ), initSubscriptions : initializingModel -> Platform.Sub.Sub initializingMsg, initUpdate : initializingMsg -> initializingModel -> ( initializingModel, Platform.Cmd.Cmd initializingMsg ), initView : List.List blockingReason -> initializingModel -> Html.Html initializingMsg, toRunning : initializingModel -> Result.Result (List.List blockingReason) ( runningModel, Platform.Cmd.Cmd runningMsg ) } -> { subscriptions : runningModel -> Platform.Sub.Sub runningMsg, update : runningMsg -> runningModel -> ( runningModel, Platform.Cmd.Cmd runningMsg ), view : runningModel -> Html.Html runningMsg } -> Initialization.Advanced.Program flag initializingModel initializingMsg runningModel runningMsg"}],"binops":[]},{"name":"Initialization.Debuggable","comment":" This module enables you to prepare more precise debugging information\nthan the `Initialization` module.\n\nThe information provided by this module is available only when you compile\nyour application with `elm make --debug`.\n\nWhen you use the `Initialization` module, the information shown in the Elm\nDebugger during the initializing phase is often surprisingly poor.\nThis is because all `Msg` values in that phase are model-transforming functions,\nwhich the debugger can only display as `<internals>`.\n\nBy using this module, you can:\n\n  - add `String` descriptions to each model-transforming function returned by commands\n  - inspect additional information when a transformation is executed, based on the `initializingModel` values before and after the transformation\n\n\n# How to Migrate from the `Initialization` Module\n\n1.  Change `import Initialization as Init`\n    to `import Initialization.Debuggable as Init`.\n    Using the same alias saves time and effort.\n\n2.  Add `Init.toDebuggableCmd \"\" (always Nothing)`\n    before each `Cmd` value passed to `Cmd.batch` in your `init` function.\n\n3.  Add `Init.toDebuggable \"\" (always Nothing)`\n    before each model-transforming function in the `Html` value returned\n    from the `initView` function.\n\n4.  Fill in the empty string arguments (`\"\"`) with descriptions as needed.\n\n5.  Replace any of the `(always Nothing)` functions with\n    `({ old : initializingModel, new : initializingModel } -> updateInfo)`,\n    where `updateInfo` is any type you define.\n    Wrapping the value in `Just` is usually sufficient.\n\n\n# Example Code\n\nThe code below demonstrates how to debug Posix time initialization.\n\n    import Html\n    import Initialization.Debuggable as Init\n    import Task\n    import Time\n\n    type InitUpdateInfo\n        = PosixTimeUpdated { old : Maybe Time.Posix, new : Maybe Time.Posix }\n\n    type Msg\n        = Tick Time.Posix\n\n    main : Init.Program () { mTimezone : Maybe Time.Zone, mPosixTime : Maybe Time.Posix } InitUpdateInfo { timezone : Time.Zone, posixTime : Time.Posix } Msg\n    main =\n        Init.element\n            { init =\n                \\() ->\n                    ( { mTimezone = Nothing\n                      , mPosixTime = Nothing\n                      }\n                    , Cmd.batch\n                        [ Init.toDebuggableCmd \"\"\n                            (always Nothing)\n                            (Task.perform (\\tz im -> { im | mTimezone = Just tz }) Time.here)\n                        , Init.toDebuggableCmd \"updating posix time\"\n                            (\\{ old, new } -> PosixTimeUpdated { old = old.mPosixTime, new = new.mPosixTime })\n                            (Task.perform (\\pt im -> { im | mPosixTime = Just pt }) Time.now)\n                        ]\n                    )\n            , initView =\n                \\blockingReasons iModel -> Html.div [] (List.map Html.text blockingReasons |> List.intersperse (Html.br [] []))\n            , toRunning =\n                \\{ mTimezone, mPosixTime } ->\n                    Ok (\\tz pt -> ( { timezone = tz, posixTime = pt }, Cmd.none ))\n                        |> Init.accumulate\n                            (Result.fromMaybe \"No timezone\" mTimezone)\n                        |> Init.accumulate\n                            (Result.fromMaybe \"No posixTime\" mPosixTime)\n            }\n            { subscriptions =\n                \\_ -> Time.every 1000 Tick\n            , update =\n                \\msg model ->\n                    case msg of\n                        Tick pt ->\n                            ( { model | posixTime = pt }, Cmd.none )\n            , view =\n                \\{ timezone, posixTime } ->\n                    Html.text <|\n                        String.fromInt (Time.toHour timezone posixTime)\n                            ++ \" : \"\n                            ++ String.fromInt (Time.toMinute timezone posixTime)\n                            ++ \" : \"\n                            ++ String.fromInt (Time.toSecond timezone posixTime)\n            }\n\n\n# Types\n\n@docs Program, MsgWithInfo\n\n\n# Msg Converters\n\n@docs toDebuggableCmd, toDebuggable\n\n\n# Main Functions\n\n@docs element, document\n\n\n# Helper\n\n@docs accumulate\n\n","unions":[{"name":"MsgWithInfo","comment":" `Msg` type used internally to represent model-transforming steps during the initializing phase.\n","args":["initUpdateInfo","initializingModel"],"cases":[]}],"aliases":[{"name":"Program","comment":" Type alias for `Platform.Program flag <internally defined Model type> <internally defined Msg type>`.\n","args":["flag","initializingModel","initUpdateInfo","runningModel","runningMsg"],"type":"Initialization.Advanced.Program flag initializingModel (Initialization.Debuggable.MsgWithInfo initUpdateInfo initializingModel) runningModel runningMsg"}],"values":[{"name":"accumulate","comment":" The same as `Initialization.accumulate`.\n","type":"Result.Result blockingReason a -> Result.Result (List.List blockingReason) (a -> b) -> Result.Result (List.List blockingReason) b"},{"name":"document","comment":" Similar to `Initialization.document`, but requires that all `Msg` values\nare converted from `initializingModel -> initializingModel`\ninto `MsgWithInfo initUpdateInfo initializingModel`\nusing `toDebuggableCmd` and `toDebuggable`.\n","type":"{ init : flag -> ( initializingModel, Platform.Cmd.Cmd (Initialization.Debuggable.MsgWithInfo initUpdateInfo initializingModel) ), initView : List.List blockingReason -> initializingModel -> Browser.Document (Initialization.Debuggable.MsgWithInfo initUpdateInfo initializingModel), toRunning : initializingModel -> Result.Result (List.List blockingReason) ( runningModel, Platform.Cmd.Cmd runningMsg ) } -> { subscriptions : runningModel -> Platform.Sub.Sub runningMsg, update : runningMsg -> runningModel -> ( runningModel, Platform.Cmd.Cmd runningMsg ), view : runningModel -> Browser.Document runningMsg } -> Initialization.Debuggable.Program flag initializingModel initUpdateInfo runningModel runningMsg"},{"name":"element","comment":" Similar to `Initialization.element`, but requires that all `Msg` values\nare converted from `initializingModel -> initializingModel`\ninto `MsgWithInfo initUpdateInfo initializingModel`\nusing `toDebuggableCmd` and `toDebuggable`.\n","type":"{ init : flag -> ( initializingModel, Platform.Cmd.Cmd (Initialization.Debuggable.MsgWithInfo initUpdateInfo initializingModel) ), initView : List.List blockingReason -> initializingModel -> Html.Html (Initialization.Debuggable.MsgWithInfo initUpdateInfo initializingModel), toRunning : initializingModel -> Result.Result (List.List blockingReason) ( runningModel, Platform.Cmd.Cmd runningMsg ) } -> { subscriptions : runningModel -> Platform.Sub.Sub runningMsg, update : runningMsg -> runningModel -> ( runningModel, Platform.Cmd.Cmd runningMsg ), view : runningModel -> Html.Html runningMsg } -> Initialization.Debuggable.Program flag initializingModel initUpdateInfo runningModel runningMsg"},{"name":"toDebuggable","comment":" Converts `initializingModel -> initializingModel`\ninto `MsgWithInfo updateInfo initializingModel`.\n\nThis function is intended to be used in the `initView` function.\n\n","type":"String.String -> ({ old : initializingModel, new : initializingModel } -> initUpdateInfo) -> (initializingModel -> initializingModel) -> Initialization.Debuggable.MsgWithInfo initUpdateInfo initializingModel"},{"name":"toDebuggableCmd","comment":" Converts `Cmd (initializingModel -> initializingModel)`\ninto `Cmd (MsgWithInfo updateInfo initializingModel)`.\n\nThis function is intended to be used in the `init` function.\n\n","type":"String.String -> ({ old : initializingModel, new : initializingModel } -> initUpdateInfo) -> Platform.Cmd.Cmd (initializingModel -> initializingModel) -> Platform.Cmd.Cmd (Initialization.Debuggable.MsgWithInfo initUpdateInfo initializingModel)"}],"binops":[]}]