[{"name":"Bimap","comment":" Bidirectional mapping/comparison/JSON (en,de)coding between Strings and types.\n\n@docs Bimap\n\n@docs init\n\n@docs variant\n\n@docs build\n\n@docs fromString\n\n@docs toString\n\n@docs values\n\n@docs toIndex\n\n@docs fromIndex\n\n@docs compare\n\n@docs decoder\n\n@docs encoder\n\n","unions":[{"name":"Bimap","comment":" A bidirectional map between a `String` and a custom type.\n","args":["a"],"cases":[]}],"aliases":[],"values":[{"name":"build","comment":" Resolves your maps and pattern-matching function into\na `Bimap` that you can use.\n\n    ... -- calls to Bimap.variant go before the call to Bimap.build\n    |> Bimap.build\n\n","type":"Bimap.Builder (a -> String.String) a -> Bimap.Bimap a"},{"name":"compare","comment":" Compares two custom type values in a `Bimap`. Very useful for sorting when partially applied and passed to [`List.sortWith`](https://package.elm-lang.org/packages/elm/core/latest/List#sortWith).\n\n    type Response\n        = Yes\n        | No\n\n\n    bimap : Bimap Response\n    bimap =\n        Bimap.init\n            (\\yes no value ->\n                case value of\n                    Yes ->\n                        yes\n\n                    No ->\n                        no\n            )\n            |> Bimap.variant \"Yes\" Yes\n            |> Bimap.variant \"No\" No\n            |> Bimap.build\n\n    sort : List Response -> List Response\n    sort =\n        List.sortWith (Bimap.compare bimap)\n\n\n    sort [ No, Yes ] -- [ Yes, No ]\n\n","type":"Bimap.Bimap a -> a -> a -> Basics.Order"},{"name":"decoder","comment":" Decoder for a custom type value in a `Bimap`.\n\n    import Json.Decode as Decode exposing (Decoder)\n\n    type Response\n        = Yes\n        | No\n\n\n    bimap : Bimap Response\n    bimap =\n        Bimap.init\n            (\\yes no value ->\n                case value of\n                    Yes ->\n                        yes\n\n                    No ->\n                        no\n            )\n            |> Bimap.variant \"Yes\" Yes\n            |> Bimap.variant \"No\" No\n            |> Bimap.build\n\n    decoder : Decoder Response\n    decoder =\n        Bimap.decoder bimap\n\n    okJson : String\n    okJson =\n        \"\"\"{ \"response\": \"Yes\" }\"\"\"\n\n    badJson : String\n    badJson =\n        \"\"\"{ \"response\": \"Maybe\" }\"\"\"\n\n    jsonDecoder : Decoder Response\n    jsonDecoder =\n        Decode.field \"response\" decoder\n\n    Decode.decodeString jsonDecoder okJson -- Ok Yes\n    Decode.decodeString jsonDecoder badJson -- Err (Field \"number\" (Failure \"Decode failed; Six is not a valid value. Expected one of: One; Two; Three\" <internals>))\n\n\n    sort [ No, Yes ] -- [ Yes, No ]\n\n","type":"Bimap.Bimap a -> Json.Decode.Decoder a"},{"name":"encoder","comment":" Encoder for a custom type value in a `Bimap`.\n\n    import Json.Encode as Encode\n\n    type Response\n        = Yes\n        | No\n\n\n    bimap : Bimap Response\n    bimap =\n        Bimap.init\n            (\\yes no value ->\n                case value of\n                    Yes ->\n                        yes\n\n                    No ->\n                        no\n            )\n            |> Bimap.variant \"Yes\" Yes\n            |> Bimap.variant \"No\" No\n            |> Bimap.build\n\n\n    encoder : Response -> Encode.Value\n    encoder =\n        Bimap.encoder bimap\n\n    Encoder.encode 0 (encoder Yes) -- \"\\\"Yes\\\"\"\n\n","type":"Bimap.Bimap a -> a -> Json.Encode.Value"},{"name":"fromIndex","comment":" Returns `Just a` for a custom type value at a given `Int` index, if one exists; `Nothing` otherwise. Values are indexed in the same order that they were added.\n\n    type Response\n        = Yes\n        | No\n\n\n    bimap : Bimap Response\n    bimap =\n        Bimap.init\n            (\\yes no value ->\n                case value of\n                    Yes ->\n                        yes\n\n                    No ->\n                        no\n            )\n            |> Bimap.variant \"Yes\" Yes\n            |> Bimap.variant \"No\" No\n            |> Bimap.build\n\n    Bimap.fromIndex bimap 0 -- Just Yes\n    Bimap.fromIndex bimap 1 -- Just No\n    Bimap.fromIndex bimap 2 -- Nothing\n\n","type":"Bimap.Bimap a -> Basics.Int -> Maybe.Maybe a"},{"name":"fromString","comment":" Returns the mapped custom type value for a given `String`,\nif the `String` has been mapped.\n\n    type Response\n        = Yes\n        | No\n\n    bimap : Bimap Response\n    bimap =\n        Bimap.init\n            (\\yes no value ->\n                case value of\n                    Yes ->\n                        yes\n\n                    No ->\n                        no\n            )\n            |> Bimap.variant \"Yes\" Yes\n            |> Bimap.variant \"No\" No\n            |> Bimap.build\n\n\n    Bimap.fromString bimap \"Yes\" --> Yes\n    Bimap.fromString bimap \"Maybe\" --> Nothing\n\n","type":"Bimap.Bimap a -> String.String -> Maybe.Maybe a"},{"name":"init","comment":" Initializes a `Bimap`. You will need to pass a pattern-matching function\nwith one parameter per variant, plus an extra parameter for the \"value\".\n\n    type Response\n        = Yes\n        | No\n\n    bimap : Bimap Response\n    bimap =\n        Bimap.init\n            (\\yes no value ->\n                case value of\n                    Yes ->\n                        yes\n\n                    No ->\n                        no\n            )\n            |> Bimap.variant \"Yes\" Yes\n            |> Bimap.variant \"No\" No\n            |> Bimap.build\n\n","type":"match -> Bimap.Builder match v"},{"name":"toIndex","comment":" Returns the `Int` index of a custom type value. Values are indexed in the same order that they were added.\n\n    type Response\n        = Yes\n        | No\n\n\n    bimap : Bimap Response\n    bimap =\n        Bimap.init\n            (\\yes no value ->\n                case value of\n                    Yes ->\n                        yes\n\n                    No ->\n                        no\n            )\n            |> Bimap.variant \"Yes\" Yes\n            |> Bimap.variant \"No\" No\n            |> Bimap.build\n\n    Bimap.toIndex bimap Yes -- 0\n    Bimap.toIndex bimap No -- 1\n\n","type":"Bimap.Bimap a -> a -> Basics.Int"},{"name":"toString","comment":" Returns the mapped `String` for a given custom type value.\n\n    type Response\n        = Yes\n        | No\n\n    bimap :\n        Bimap Response\n    bimap =\n        Bimap.init\n            (\\yes no value ->\n                case value of\n                    Yes ->\n                        yes\n\n                    No ->\n                        no\n            )\n            |> Bimap.variant \"Yes\" Yes\n            |> Bimap.variant \"No\" No\n            |> Bimap.build\n\n\n    Bimap.toString No --> \"No\"\n\n","type":"Bimap.Bimap a -> a -> String.String"},{"name":"values","comment":" Returns a `List` of tuples of all `String` keys and custom type values, in the same order that they were added.\n\n    type Response\n        = Yes\n        | No\n\n    bimap : Bimap Response\n    bimap =\n        Bimap.init\n            (\\yes no value ->\n                case value of\n                    Yes ->\n                        yes\n\n                    No ->\n                        no\n            )\n            |> Bimap.variant \"Yes\" Yes\n            |> Bimap.variant \"No\" No\n            |> Bimap.build\n\n\n    Bimap.values bimap -- [ ( \"Yes\", Yes ), ( \"No\", No ) ]\n\n","type":"Bimap.Bimap a -> List.List ( String.String, a )"},{"name":"variant","comment":" Adds a map between a `String` and a value of your custom type.\n\n    ... -- a pattern-matching function goes before the variants\n    |> Bimap.variant \"Yes\" Yes\n    |> Bimap.variant \"No\" No\n    ... -- a call to Bimap.build goes after\n\n","type":"String.String -> v -> Bimap.Builder (String.String -> b) v -> Bimap.Builder b v"}],"binops":[]}]