[{"name":"Csv.Decode","comment":" Decode values from CSV. A crash course on constructing decoders:\n\n  - To decode basic values in different columns, use [`field`](#field) or\n    [`column`](#column) along with [`int`](#int), [`string`](#string), or\n    [`float`](#float).\n  - To transform values in ways that can't fail, pass them to [`map`](#map). To\n    transform them in ways that _can_ fail, pass decoders to\n    [`andThen`](#andThen) and call [`succeed`](#succeed) or [`fail`](#fail)\n    to handle the failure gracefully.\n  - To decode simple multi-field values, pass a constructor to [`map2`](#map2)\n    or [`map3`](#map3).\n  - For records with more than two or three values, use [`pipeline`](#pipeline)\n    and [`required`](#required).\n\nAll of those functions have examples in their documentation. Check 'em out!\n\nIf you run into trouble, this library intentionally sticks as close to [`elm/json`](https://package.elm-lang.org/packages/elm/json/latest/) and [`NoRedInk/elm-json-decode-pipeline`](https://package.elm-lang.org/packages/NoRedInk/elm-json-decode-pipeline/latest/) semantics as possible.\nFiguring out how you'd write an equivalent JSON decoder may help!\n(But if you run into something you truly can't do, please [open an issue](https://github.com/BrianHicks/elm-csv/issues/new).)\n\n\n## Basic Decoders\n\n@docs Decoder, string, int, float, blank\n\n\n## Finding Values\n\n@docs column, field\n\n\n## Running Decoders\n\n@docs FieldNames, decodeCsv, decodeCustom, Error, errorToString, Problem\n\n\n## Transforming Values\n\n@docs map, map2, map3, pipeline, required\n\n\n## Fancy Decoding\n\n@docs oneOf, succeed, fail, andThen, fromResult\n\n","unions":[{"name":"Decoder","comment":" A way to specify what kind of thing you want to decode into. For example,\nif you have a `Pet` data type, you'd want a `Decoder Pet`.\n","args":["a"],"cases":[]},{"name":"Error","comment":" Sometimes things go wrong. This is how we tell you what happened. If you\nneed to present this to somone, you can get a human-readable version with\n[`errorToString`](#errorToString)\n\nSome more detail:\n\n  - `ConfigError`: `decodeCustom` got a bad separator character\n  - `ParsingError`: there was a problem parsing the data (the most common issue\n    is problems with quoted fields. Check that any quoted fields are closed\n    and that quotes are escaped by doubling.)\n  - `DecodingError`: we couldn't decode a value using the specified\n    decoder. See [`Problem`](#Problem) for more details.\n\n","args":[],"cases":[["ConfigError",["Csv.Parser.ConfigProblem"]],["ParsingError",["List.List Parser.DeadEnd"]],["DecodingError",["{ row : Basics.Int, problem : Csv.Decode.Problem }"]]]},{"name":"FieldNames","comment":" Where do we get names for use with [`field`](#field)?\n\n  - `NoFieldNames`: don't get field names at all. [`field`](#field) will always fail.\n  - `CustomFieldNames`: use the provided field names in order (so `[\"Id\", \"Name\"]`\n    will mean that \"Id\" is in column 0 and \"Name\" is in column 1.)\n  - `FieldNamesFromFirstRow`: use the first row of the CSV as the source of\n    field names.\n\n","args":[],"cases":[["NoFieldNames",[]],["CustomFieldNames",["List.List String.String"]],["FieldNamesFromFirstRow",[]]]},{"name":"Problem","comment":" Things that went wrong specifically while decoding.\n\n  - `NoFieldNamesOnFirstRow`: we tried to get the field names from the first\n    row (using [`FieldNames`](#FieldNames)) but couldn't find any, probably\n    because the input was blank.\n  - `ExpectedColumn Int` and `ExpectedField String`: we looked for a value\n    at a specific column, but couldn't find it. The argument specifies where\n    we tried to look.\n  - `AmbiguousColumn`: basic decoders expect to find a single value. If there\n    are multiple fields in a row, and you don't specify which one to use with\n    [`column`](#column) or [`field`](#field), you'll get this error.\n  - `ExpectedInt String` and `ExpectedFloat String`: we tried to parse a\n    string into a number, but couldn't. The arguments specify the strings\n    we got.\n  - `Failure`: messages from [`fail`](#fail) end up here.\n  - `ManyProblems`: when there are multiple failures, messages from\n    [`oneOf`](#oneOf) end up here.\n\n","args":[],"cases":[["NoFieldNamesOnFirstRow",[]],["ExpectedColumn",["Basics.Int"]],["ExpectedField",["String.String"]],["AmbiguousColumn",[]],["ExpectedInt",["String.String"]],["ExpectedFloat",["String.String"]],["Failure",["String.String"]],["ManyProblems",["Csv.Decode.Problem","Csv.Decode.Problem"]]]}],"aliases":[],"values":[{"name":"andThen","comment":" Decode some value _and then_ make a decoding decision based on the\noutcome. For example, if you wanted to reject negative numbers, you might\ndo something like this:\n\n    positiveInt : Decoder Int\n    positiveInt =\n        int\n            |> andThen\n                (\\rawInt ->\n                    if rawInt < 0 then\n                        Decode.fail \"Only positive numbers allowed!\"\n\n                    else\n                        Decode.succeed rawInt\n                )\n\nYou could then use it like this:\n\n    decodeCsv NoFieldNames positiveint \"1\" -- Ok [ 1 ]\n\n    decodeCsv NoFieldNames positiveInt \"-1\"\n    -- Err { row = 0, problem = Failure \"Only positive numbers allowed!\" }\n\n","type":"(a -> Csv.Decode.Decoder b) -> Csv.Decode.Decoder a -> Csv.Decode.Decoder b"},{"name":"blank","comment":" Handle blank fields by making them into `Maybe`s.\n\n    decodeCsv NoFieldNames (blank int) \"\\r\\n1\"\n    --> Ok [ Nothing, Just 1 ]\n\n    decodeCsv NoFieldNames (blank int) \"not a number\"\n    --> Err (DecodingError { row = 0, problem = ExpectedInt \"not a number\" })\n\n","type":"Csv.Decode.Decoder a -> Csv.Decode.Decoder (Maybe.Maybe a)"},{"name":"column","comment":" Parse a value at a numbered column in the CSV, starting from 0.\n\n    decodeCsv NoFieldNames (column 0 string) \"Argentina\" --> Ok [ \"Argentina\" ]\n\n    decodeCsv NoFieldNames (column 1 int) \"1,2,3\" --> Ok [ 2 ]\n\n    decodeCsv NoFieldNames (column 100 float) \"3.14\"\n    --> Err (DecodingError { row = 0, problem = ExpectedColumn 100 })\n\n","type":"Basics.Int -> Csv.Decode.Decoder a -> Csv.Decode.Decoder a"},{"name":"decodeCsv","comment":" Convert a CSV string into some type you care about using the\n[`Decoder`](#Decoder)s in this module!\n","type":"Csv.Decode.FieldNames -> Csv.Decode.Decoder a -> String.String -> Result.Result Csv.Decode.Error (List.List a)"},{"name":"decodeCustom","comment":" Convert something shaped roughly like a CSV. For example, to decode\ntab-separated values where the row separator is a single newline character:\n\n    decodeCustom\n        { rowSeparator = \"\\n\"\n        , fieldSeparator = \"\\t\"\n        }\n        NoFieldNames\n        (map2 Tuple.pair\n            (column 0 int)\n            (column 1 string)\n        )\n        \"1\\tBrian\\n2\\tAtlas\"\n        --> Ok [ ( 1, \"Brian\" ), ( 2, \"Atlas\" ) ]\n\n","type":"{ rowSeparator : String.String, fieldSeparator : String.String } -> Csv.Decode.FieldNames -> Csv.Decode.Decoder a -> String.String -> Result.Result Csv.Decode.Error (List.List a)"},{"name":"errorToString","comment":" Want an human-readable version of an [`Error`](#Error)? Here we are!\n","type":"Csv.Decode.Error -> String.String"},{"name":"fail","comment":" Always fail with the given message, no matter what. Mostly useful with\n[`andThen`](#andThen).\n","type":"String.String -> Csv.Decode.Decoder a"},{"name":"field","comment":" Parse a value at a named column in the CSV. There are a number of ways\nto provide these names, see [`FieldNames`](#FieldNames)\n\n    decodeCsv\n        FieldNamesFromFirstRow\n        (field \"Country\" string)\n        \"Country\\r\\nArgentina\"\n    --> Ok [ \"Argentina\" ]\n\n    decodeCsv\n        (CustomFieldNames [ \"a\", \"b\", \"c\" ])\n        (field \"b\" int)\n        \"1,2,3\"\n    --> Ok [ 2 ]\n\n    decodeCsv\n        (CustomFieldNames [ \"Constant\" ])\n        (field \"Nonexistent\" float)\n        \"3.14\"\n    --> Err (DecodingError { row = 0, problem = ExpectedField \"Nonexistent\" })\n\n","type":"String.String -> Csv.Decode.Decoder a -> Csv.Decode.Decoder a"},{"name":"float","comment":" Decode an integer from a CSV.\n\n    decodeCsv NoFieldNames float \"3\" --> Ok [ 3.0 ]\n\n    decodeCsv NoFieldNames float \"3.14\" --> Ok [ 3.14 ]\n\n    decodeCsv NoFieldNames float \"mimesis\"\n    --> Err (DecodingError { row = 0, problem = ExpectedFloat \"mimesis\" })\n\nUnless you specify otherwise (e.g. with [`column`](#column)) this will assume\nthere is only one column in the CSV and try to decode that.\n\n    decodeCsv NoFieldNames float \"1.0,2.0\"\n    --> Err (DecodingError { row = 0, problem = AmbiguousColumn })\n\n","type":"Csv.Decode.Decoder Basics.Float"},{"name":"fromResult","comment":" Make creating custom decoders a little easier. If you already have a\nfunction that parses a string into something you care about, you can probably\nprovide it here and avoid having to build your own with [`andThen`](#andThen).\n\nFor example, here's how you could parse a hexadecimal number with\n[`rtfeldman/elm-hex`](https://package.elm-lang.org/packages/rtfeldman/elm-hex/latest/):\n\n    import Hex\n\n    hex : Decoder Int\n    hex =\n        fromResult Hex.fromString\n\n    decodeCsv NoFieldNames hex \"ff\"\n    --> Ok [ 255 ]\n\n","type":"(String.String -> Result.Result String.String a) -> Csv.Decode.Decoder a"},{"name":"int","comment":" Decode an integer from a CSV.\n\n    decodeCsv NoFieldNames int \"1\" --> Ok [ 1 ]\n\n    decodeCsv NoFieldNames int \"-1\" --> Ok [ -1 ]\n\n    decodeCsv NoFieldNames int \"volcano\"\n    --> Err (DecodingError { row = 0, problem = ExpectedInt \"volcano\" })\n\nUnless you specify otherwise (e.g. with [`column`](#column)) this will assume\nthere is only one column in the CSV and try to decode that.\n\n    decodeCsv NoFieldNames int \"1,2\"\n    --> Err (DecodingError { row = 0, problem = AmbiguousColumn })\n\n","type":"Csv.Decode.Decoder Basics.Int"},{"name":"map","comment":" Decode a value, then transform it before returning.\n\n    decodeCsv NoFieldNames (map (\\i -> i * 2) int) \"15\" --> Ok [ 30 ]\n\n    decodeCsv NoFieldNames (map String.reverse string) \"slap\" --> Ok [ \"pals\" ]\n\n","type":"(from -> to) -> Csv.Decode.Decoder from -> Csv.Decode.Decoder to"},{"name":"map2","comment":" Combine two decoders to make something else, for example a tuple:\n\n    decodeCsv NoFieldNames\n        (map2 Tuple.pair\n            (column 0 int)\n            (column 1 string)\n        )\n        \"1,Atlas\"\n        --> Ok [ (1, \"Atlas\") ]\n\n","type":"(a -> b -> c) -> Csv.Decode.Decoder a -> Csv.Decode.Decoder b -> Csv.Decode.Decoder c"},{"name":"map3","comment":" Like [`map2`](#map2), but with three decoders. `map4` and beyond don't\nexist in this package. Use [`pipeline`](#pipeline) to decode records instead!\n\n    decodeCsv NoFieldNames\n        (map3 (\\r g b -> (r, g, b))\n            (column 0 int)\n            (column 1 int)\n            (column 2 int)\n        )\n        \"255,255,0\"\n        --> Ok [ (255, 255, 0) ]\n\n","type":"(a -> b -> c -> d) -> Csv.Decode.Decoder a -> Csv.Decode.Decoder b -> Csv.Decode.Decoder c -> Csv.Decode.Decoder d"},{"name":"oneOf","comment":" Try several possible decoders in sequence, committing to the first one\nthat passes.\n\n    decodeCsv NoFieldNames (oneOf (map Just int) [ succeed Nothing ]) \"1\"\n    --> Ok [ Just 1 ]\n\n    decodeCsv NoFieldNames (oneOf (map Just int) [ succeed Nothing ]) \"a\"\n    --> Ok [ Nothing ]\n\n","type":"Csv.Decode.Decoder a -> List.List (Csv.Decode.Decoder a) -> Csv.Decode.Decoder a"},{"name":"pipeline","comment":" Need to decode into an object? Use a pipeline. The way this works: you\nprovide a function that takes as many arguments as you need, and then send\nit values by providing decoders.\n\n    type alias Pet =\n        { id : Int\n        , name : String\n        , species : String\n        , weight : Float\n        }\n\n    petDecoder : Decoder Pet\n    petDecoder =\n        pipeline Pet\n            |> required (column 0 int)\n            |> required (column 1 string)\n            |> required (column 2 string)\n            |> required (column 3 float)\n\nNow you can decode pets like this:\n\n    decodeCsv NoFieldNames petDecoder \"1,Atlas,cat,14.5\"\n    --> Ok [ { id = 1, name = \"Atlas\", species = \"cat\", weight = 14.5 } ]\n\n","type":"(a -> b) -> Csv.Decode.Decoder (a -> b)"},{"name":"required","comment":" See [`pipeline`](#pipeline).\n","type":"Csv.Decode.Decoder a -> Csv.Decode.Decoder (a -> b) -> Csv.Decode.Decoder b"},{"name":"string","comment":" Decode a string from a CSV.\n\n    decodeCsv NoFieldNames string \"a\" --> Ok [ \"a\" ]\n\nUnless you specify otherwise (e.g. with [`column`](#column)) this will assume\nthere is only one column in the CSV and try to decode that.\n\n    decodeCsv NoFieldNames string \"a,b\"\n    --> Err (DecodingError { row = 0, problem = AmbiguousColumn })\n\n","type":"Csv.Decode.Decoder String.String"},{"name":"succeed","comment":" Always succeed, no matter what. Mostly useful with [`andThen`](#andThen).\n","type":"a -> Csv.Decode.Decoder a"}],"binops":[]},{"name":"Csv.Parser","comment":" CSV (and TSV) parsing.\n\n\n## Configuration\n\n@docs Config, config, ConfigProblem\n\n\n## Parsing\n\n@docs parse\n\n","unions":[{"name":"Config","comment":" See [`config`](#config)\n","args":[],"cases":[]},{"name":"ConfigProblem","comment":" Not every string is a valid separator. This structure lets you know if\n[`config`](#config) gets something bad.\n","args":[],"cases":[["NeedNonBlankRowSeparator",[]],["NeedNonBlankFieldSeparator",[]]]}],"aliases":[],"values":[{"name":"config","comment":" Parse a row and field separator into something [`parse`](#parse) can use.\n","type":"{ rowSeparator : String.String, fieldSeparator : String.String } -> Result.Result Csv.Parser.ConfigProblem Csv.Parser.Config"},{"name":"parse","comment":" Parse some data into a string-only list of lists. Prefer\nusing `Csv.Decode.decodeCsv` or `Csv.Decode.decodeCustom`\nunless you need something unusally custom (and please [open an\nissue](https://github.com/BrianHicks/elm-csv/issues/new) if you do!)\n","type":"Csv.Parser.Config -> String.String -> Result.Result (List.List Parser.DeadEnd) (List.List (List.List String.String))"}],"binops":[]}]