[
    {
        "name": "Porter.Multi",
        "comment": " With `Porter.Multi` you can create requests that have specialized return values.\n\nThis is an advanced usage pattern of Porter. For most use-cases, using Porter itself should be sufficient. If, however, you have a tangible issue with expressing chaining and transformations with your port messages, read along :).\n\nThe setup is exactly the same as when using Porter normally. Just use the `request` and `send` commands that this module provides instead to create requests with specialized return types.\n\nMapping over responses and chaining requests is supported.\n\n\n# Send Messages\n\n@docs Request\n@docs request, send\n@docs fromSimple\n\n\n# Chain Requests\n\n@docs andThen, andThenResult, map, map2, map3\n\n",
        "unions": [],
        "aliases": [
            {
                "name": "Request",
                "comment": " We can either:\n\n  - Perform a single request, which will run the Porter Request and at the end turn the result into an `a`,\n  - Perform multiple requests: At the end of this request, run a function on the output that generates the next request. Note that this is set up in such a way that only the type of the final request in the chain matters.\n  - Short-circuit; just pass on the value `a` without doing any more requests.\n\n",
                "args": [
                    "req",
                    "res",
                    "a"
                ],
                "type": "MultiRequest req res a"
            }
        ],
        "values": [
            {
                "name": "andThen",
                "comment": " Combines together multiple Porter.Multi requests\n",
                "type": "(a -> Request req res b) -> Request req res a -> Request req res b"
            },
            {
                "name": "andThenResult",
                "comment": " andThenResult function similar to `andThen`,\nbut will short-circuit the request/response chain once an `Err val` is received.\n\nWorking with Result-objects is very common, since the specialising of `res -> a` (that you pass to `request`) is usually an operation that might fail (like a Decoder)\n\n",
                "type": "(a -> Request req res (Result err b)) -> Request req res (Result err a) -> Request req res (Result err b)"
            },
            {
                "name": "fromSimple",
                "comment": " Turns a simple Porter request into a Porter.Multi request\n",
                "type": "Request req res -> Request req res res"
            },
            {
                "name": "map",
                "comment": " Turns the request's specialized response type into a different type.\n",
                "type": "(a -> b) -> Request req res a -> Request req res b"
            },
            {
                "name": "map2",
                "comment": " Chains two requests, and then combines their two responses into one new `c`.\n",
                "type": "(a -> b -> c) -> Request req res a -> Request req res b -> Request req res c"
            },
            {
                "name": "map3",
                "comment": " Chains three requests, and then combines their three responses into one new `c`.\n",
                "type": "(a -> b -> c -> d) -> Request req res a -> Request req res b -> Request req res c -> Request req res d"
            },
            {
                "name": "request",
                "comment": " Creates a new Porter.Multi request, specifying:\n\n  - the request itself in the common `req` type\n  - A response handler function tha turns the common `res` type into a specialized `a`.\n\n",
                "type": "req -> (res -> a) -> Request req res a"
            },
            {
                "name": "send",
                "comment": " Actually sends a (chain of) request(s).\n\nA final handler needs to be specified that turns the final result into a `msg`.\nThis `msg` will be called with the final resulting `a` once the final response has returned.\n\n",
                "type": "Config req res msg -> (a -> msg) -> Request req res a -> Cmd msg"
            }
        ],
        "binops": []
    },
    {
        "name": "Porter",
        "comment": " Port message manager to emulate a request-response style communication through ports, a'la `Http.send ResponseHandler request`.\n\n\n# Configuration\n\n@docs Config\n\n\n# The setup\n\n@docs Model, Msg, init, update, subscriptions\n\n\n# Send messages\n\n@docs Request\n@docs request, andThen, send\n\n",
        "unions": [
            {
                "name": "Model",
                "comment": " Porter model, used to keep track of response handlers.\n",
                "args": [
                    "req",
                    "res",
                    "msg"
                ],
                "cases": []
            }
        ],
        "aliases": [
            {
                "name": "Config",
                "comment": " Porter configuration, containing:\n\n  - ports\n  - message encoders/decoders.\n  - the message that porter will use for its internal communications\n\n",
                "args": [
                    "req",
                    "res",
                    "msg"
                ],
                "type": "Config req res msg"
            },
            {
                "name": "Msg",
                "comment": " Module messages.\n",
                "args": [
                    "req",
                    "res",
                    "msg"
                ],
                "type": "Msg req res msg"
            },
            {
                "name": "Request",
                "comment": " Opaque type of a 'request'. Use the `request` function to create one,\nchain them using `andThen` and finally send it using `send`.\n",
                "args": [
                    "req",
                    "res"
                ],
                "type": "Request req res"
            }
        ],
        "values": [
            {
                "name": "andThen",
                "comment": " Chains two Porter requests together:\nRun a second one right away when the first returns using its result in the request.\n",
                "type": "(res -> Request req res) -> Request req res -> Request req res"
            },
            {
                "name": "init",
                "comment": " Initialize model.\n",
                "type": "Model req res msg"
            },
            {
                "name": "request",
                "comment": " Starts a request that can be sent at a later time using `send`,\nand that can be combined using `andThen`.\n",
                "type": "req -> Request req res"
            },
            {
                "name": "send",
                "comment": " Sends a request earlier started using `request`.\n",
                "type": "Config req res msg -> (res -> msg) -> Request req res -> Cmd msg"
            },
            {
                "name": "subscriptions",
                "comment": " Subscribe to messages from ports.\n",
                "type": "Config req res msg -> Sub msg"
            },
            {
                "name": "update",
                "comment": " Update port model based on local messages. Returns a new port model and a local command that must be mapped to the parent message.\n",
                "type": "Config req res msg -> Msg req res msg -> Model req res msg -> ( Model req res msg, Cmd msg )"
            }
        ],
        "binops": []
    }
]