[
    {
        "name": "TheValidator",
        "comment": " This library provides a way to express validations through Validator objects\nholding the validation logic and allowing for composition.\n\n\n# Types\n\n@docs Validator\n\n@docs Validation\n\n\n# Validation\n\n@docs validate, isValid\n\n\n# Validator Constructors\n\n@docs simple, parameterized, invalid, valid\n\n\n# Validator Composition\n\n@docs all, map, focus, focusMap, list\n\n",
        "unions": [
            {
                "name": "Validator",
                "comment": " A `Validator` holds validations and corresponding errors for a model.\nThe internals of this data type are not exposed, instead see the constructors\nfor more details.\n",
                "args": [
                    "error",
                    "model"
                ],
                "cases": []
            }
        ],
        "aliases": [
            {
                "name": "Validation",
                "comment": " A `Validation` is a function that validates a model.\n",
                "args": [
                    "model"
                ],
                "type": "model -> Bool"
            }
        ],
        "values": [
            {
                "name": "all",
                "comment": " Converts a list of validator into one new validator of the same type.\nThis is useful to aggregate multiple validations on the same model (fields in\nan record, more than one check on a value, etc.).\n\n    moreThan2 = simple (flip (>) 2) \"must be greater than 2\"\n    notFactorOf3 = simple (\\n -> n % 3 /= 0) \"must not be a factor of 3\"\n    lessThan1000 = simple (flip (<) 1000) \"must be lower than 1000\"\n\n    allThose =\n      all\n      [ moreThan2\n      , notFactorOf3\n      , lessThan1000\n      ]\n\n    validate allThose 1 == [\"must be greater than 2\"]\n    validate allThose 333 == [\"must not be a factor of 3\"]\n    validate allThose 1000 == [\"must be lower than 1000\"]\n    validate allThose 12345 == [\"must not be a factor of 3\", \"must be lower than 1000\"]\n    validate allThose 124 == []\n\n    isValid allThose 778 == True\n    isValid allTHose 12 == False\n\n",
                "type": "List (Validator error model) -> Validator error model"
            },
            {
                "name": "focus",
                "comment": " Creates a new validator to check another model. The transformation function\ntakes the model provided to the new validator, extracts the model expected by\nthe original validator and feeds it instead. Useful to focus on a field of a\nrecord, part of a list, etc.\n\n    type alias Fighter = { name: String, strength : Int }\n\n    under9000 = simple (flip (<=) 9000) \"It's over 9000!!!\"\n    onlyHuman = focus .strength under9000\n\n    validate onlyHuman { name = \"Satan\", strength = 9 } == []\n    validate onlyHuman { name = \"Goku\", strength = 999999 } == [ \"It's over 9000!!!\" ]\n\n",
                "type": "(modelB -> modelA) -> Validator error modelA -> Validator error modelB"
            },
            {
                "name": "focusMap",
                "comment": " Takes a validator and transform it to work on another model and change the\nerrors. Shortcut for `focus` then `map`.\n\n    type alias User =\n        { login : String, password : String }\n\n    passwordValidator =\n        simple ((/=) \"password\") \"'password' is not a very good password\"\n\n    userValidator =\n        focusMap .password (\\{login} error -> \"for realz, \" ++ login ++ \" \" ++ error) passwordValidator\n\n    user = { name = \"Carl Streator\", password = \"password\" }\n\n    validate userValidator == [\"for realz Carl Streator 'password' is not a very good password\"]\n\n",
                "type": "(modelB -> modelA) -> (modelB -> errorA -> errorB) -> Validator errorA modelA -> Validator errorB modelB"
            },
            {
                "name": "invalid",
                "comment": " A validator that is always invalid. It will always provide the same error.\n\n    validate (invalid \"Bad, bad number!\") 111 == [\"Bad, bad number!\"]\n    isValid (invalid \"Some error message\") \"blah\" == True\n\n",
                "type": "error -> Validator error model"
            },
            {
                "name": "isValid",
                "comment": " Checks wether a model is valid according to a validator. If you care about\nthe reasons why the model is invalid, consider using `validate` instead.\n\n    bigNumber = simple (flip (>) 1000) \"Not such a big number\"\n\n    isValid bigNumber 1001 == True\n    isValid bigNumber 1000 == False\n\n",
                "type": "Validator error model -> model -> Bool"
            },
            {
                "name": "list",
                "comment": " Makes a validator that applies another validator to a list of elements.\nThe transformation function receives the index of the element under scrutiny as\nwell as the error obtained by the internal validator.\n\n    model Cup = {owner: String, temperature: Int}\n    cups =\n      [ {owner: \"Mama Bear\", temperature: 100}\n      , {owner: \"Papa Bear\", temperature: 20}\n      , {owner: \"Little Bear\", temperature: 30}\n      ]\n\n    tooHot = simple (\\cup -> cup.temperature > 30) \"it's too hot!\"\n    tooCold = simple (\\cup -> cup.temperature < 30) \"it's too cold!\"\n\n    justRight = all [tooHot, tooCold]\n\n    goldilocks = list\n      (\\index model error -> (index, model.owner ++ \"'s cup:\", error))\n      justRight\n\n    validate goldilocks cups ==\n      [ (1, \"Mama Bear's cup:\", \"it's too hot!\")\n      , (2, \"Papa Bear's cup:\", \"it's too cold!\")\n      ]\n\n",
                "type": "(Int -> model -> errorA -> errorB) -> Validator errorA model -> Validator errorB (List model)"
            },
            {
                "name": "map",
                "comment": " Decorates a validator by modifying the errors it returns. The transformation\nfunction handles the transformation from one error type to the other.\n\n    onlyTrue = simple ((==) True) \"This is simply not True!\"\n    onlyMoreTrue = onlyTrue |> map (\\model error -> (error, \"It is simply\", model, \"!\"))\n\n    validate onlyTrue False == [\"This is simply not True!\"]\n    validate onlyMoreTrue False == (\"This is simply not True!\", \"It is simply\", False, \"!\")\n\n",
                "type": "(model -> errorA -> errorB) -> Validator errorA model -> Validator errorB model"
            },
            {
                "name": "parameterized",
                "comment": " A parameterized validator that composes a single error from the model.\n\n    justMonika = parameterized ((==) \"Monika\") (\\name -> \"Not \" ++ name ++ \"! Just Monika.\")\n    validate justMonika \"Yuri\" == [\"Not Yuri! Just Monika.\"]\n\n",
                "type": "Validation model -> (model -> error) -> Validator error model"
            },
            {
                "name": "simple",
                "comment": " A simple validator that returns an error constant.\n\n    stayPositive = (simple (flip (>) 0) \"only positive numbers are allowed here stranger\")\n    validate stayPositive 0 == [\"only positive numbers are allowed here stranger\"]\n\n",
                "type": "Validation model -> error -> Validator error model"
            },
            {
                "name": "valid",
                "comment": " A validator that is always valid. It will always pass, never provide error.\n\n    validate valid 123 == []\n    isValid valid \"something\" == True\n\n",
                "type": "Validator error model"
            },
            {
                "name": "validate",
                "comment": " Validate a model using a validator, returning a list of errors. The list\nwill be empty when the model is valid. If you only care about the validity of\nthe model, consider using the more efficient `isValid` instead.\n\n    atLeast8Chars = simple (\\s -> String.length s >= 8) \"should be at least 8 chars long\"\n\n    validate atLeast8Chars \"2short\" == [\"should be at least 8 chars long\"]\n    validate atLeast8Chars \"long enough\" == []\n\n",
                "type": "Validator error model -> model -> List error"
            }
        ],
        "binops": []
    }
]