[{"name":"Elm.TypeInference","comment":" Type inference for\n[`elm-syntax`](https://package.elm-lang.org/packages/stil4m/elm-syntax/latest/)\nASTs.\n\nOptimized for lazy queries `Range -> Maybe Type`.\n\nThe process:\n\n  - Convert `elm.json` and dependencies' `elm.json` + `docs.json` into\n    [`DependencyEnv`](#DependencyEnv).\n  - Load the\n    [`File`](https://package.elm-lang.org/packages/stil4m/elm-syntax/latest/Elm-Syntax-File#File)s\n    into a [`Project`](#Project).\n  - (When it's clear you need it) Infer a module with\n    [`inferModule`](#inferModule), producing [`TypeLookupTable`](TypeLookupTable#TypeLookupTable).\n  - (When it's clear you need it) Get a [`Type`](Elm-TypeInference-Type#Type)\n    for a given AST\n    [`Node`](https://package.elm-lang.org/packages/stil4m/elm-syntax/latest/Elm-Syntax-Node#Node)'s\n    [`Range`](https://package.elm-lang.org/packages/stil4m/elm-syntax/latest/Elm-Syntax-Range#Range) with [`get`](TypeLookupTable#get).\n\n@docs dependencyEnv, DependencyEnvOutcome, DependencyEnv, Dependency\n\n@docs project, Project\n\n@docs inferModule, inferModules\n\n","unions":[{"name":"DependencyEnv","comment":" Data parsed from dependencies' `docs.json` files.\n\nThis cache doesn't change as user's project code changes - only invalidate it\nand [`Project`](#Project) when `elm.json` changes.\n\n","args":[],"cases":[]},{"name":"DependencyEnvOutcome","comment":" Possible outcomes of running [`dependencyEnv`](#dependencyEnv).\n\nAn example `NeedPackageSources`:\n\n    Dict.fromList\n        [ ( \"example/css\", [ \"src/Css/Internal.elm\" ] ) ]\n\n","args":[],"cases":[["Ready",["Elm.TypeInference.DependencyEnv"]],["NeedPackageSources",["Dict.Dict Elm.TypeInference.Type.PackageName (List.List String.String)"]],["Failed",["Elm.TypeInference.Error.Error"]]]},{"name":"Project","comment":" An indexed project: every file has been assigned a `ModuleId` and its\nimports resolved, but nothing has been solved yet. Cheap to build.\n","args":[],"cases":[]}],"aliases":[{"name":"Dependency","comment":" Input to [`dependencyEnv`](#dependencyEnv).\n\nA dependency package with its type information, parsed from the dependency's\n`elm.json` (via\n[`Elm.Project.decoder`](https://package.elm-lang.org/packages/elm/project-metadata-utils/latest/Elm-Project#decoder))\nand `docs.json` (via `elm/project-metadata-utils`\n[`Elm.Docs.decoder`](https://package.elm-lang.org/packages/elm/project-metadata-utils/latest/Elm-Docs#decoder)):\n\n  - **name:** the package identifier (e.g. `\"elm/html\"`).\n  - **dependencies:** names of the package's _immediate_ `elm.json` dependencies (eg. `\"elm/virtual-dom\"`).\n  - **modules:** the decoded `docs.json` modules.\n\n","args":[],"type":"{ name : Elm.TypeInference.Type.PackageName, dependencies : List.List Elm.TypeInference.Type.PackageName, modules : List.List Elm.Docs.Module }"}],"values":[{"name":"dependencyEnv","comment":" Build a [`DependencyEnv`](#DependencyEnv).\n\nInitially you can run with `sourcesToResolveAmbiguity = Dict.empty`. If you get\n`NeedPackageSources` back, read and parse those Elm files from the dependencies\nin your `ELM_HOME` (usually `~/.elm`) and supply them in\n`sourcesToResolveAmbiguity` in the next call.\n\n","type":"{ directDependencies : List.List Elm.TypeInference.Type.PackageName, allDependencies : List.List Elm.TypeInference.Dependency, sourcesToResolveAmbiguity : Dict.Dict Elm.TypeInference.Type.PackageName (List.List Elm.Syntax.File.File) } -> Elm.TypeInference.DependencyEnvOutcome"},{"name":"inferModule","comment":" Infer types in the given module.\n","type":"Elm.Syntax.ModuleName.ModuleName -> Elm.TypeInference.Project -> ( Result.Result Elm.TypeInference.Error.Error TypeLookupTable.TypeLookupTable, Elm.TypeInference.Project )"},{"name":"inferModules","comment":" Helper. Run [`inferModule`](#inferModules) for each of the given modules,\ncollecting successes and errors into separate `Dict`s.\n","type":"Dict.Dict Elm.Syntax.ModuleName.ModuleName Elm.Syntax.File.File -> Elm.TypeInference.Project -> ( { tables : Dict.Dict Elm.Syntax.ModuleName.ModuleName TypeLookupTable.TypeLookupTable, errors : Dict.Dict Elm.Syntax.ModuleName.ModuleName Elm.TypeInference.Error.Error }, Elm.TypeInference.Project )"},{"name":"project","comment":" Analyze the import graph of the project source code, producing a [`Project`](#Project).\n","type":"Maybe.Maybe Elm.TypeInference.Type.PackageName -> Elm.TypeInference.DependencyEnv -> Dict.Dict Elm.Syntax.ModuleName.ModuleName Elm.Syntax.File.File -> Result.Result Elm.TypeInference.Error.Error Elm.TypeInference.Project"}],"binops":[]},{"name":"Elm.TypeInference.Error","comment":" Errors reported while resolving or inferring a module.\n\n@docs Error, ErrorDetails\n@docs toString\n\n","unions":[{"name":"ErrorDetails","comment":" Types of errors:\n\n  - **`ImpossibleExpr`, `ImpossiblePattern` and `ImpossibleType`:** for\n    hand-crafted `elm-syntax` Files with nonsensical data, like a function call\n    without arguments or a 4-tuple. You should never be able to reach these when\n    using `elm-syntax`'s parser on real Elm files.\n\n  - **`ImpossibleDocsType`:** Similar but for hand-crafted `docs.json`. Real\n    `docs.json` files emitted by the Elm compiler should never produce these.\n\n  - **`MissingModuleName`:** Raised when `Elm.TypeInference.project` is called\n    with a Dict key `[]`.\n\n  - **`ModuleNotFound`:** Raised when `Elm.TypeInference.inferModule` is called\n    with module that's not part of the indexed `Project`.\n\n  - **`VarNotFound`:**\n\n        module Main exposing (foo)\n\n        foo =\n            bar\n\n        --> VarNotFound\n        --    { usedIn = [ \"Main\" ]\n        --    , varName = \"bar\"\n        --    }\n\n  - **`AmbiguousName`:**\n\n        module Main exposing (foo)\n\n        import A exposing (thing)\n        import B exposing (thing)\n\n        foo =\n            thing\n\n        --> AmbiguousName\n        --    { usedIn = [ \"Main\" ]\n        --    , varName = \"thing\"\n        --    , possibleModules = [ [ \"A\" ], [ \"B\" ] ]\n        --    }\n\n  - **`AmbiguousModuleOwner`:**\n\n    Raised when two direct dependencies expose a module of the same name, eg.\n    `mdgriffith/elm-ui` and `mdgriffith/style-elements` (both expose `Element`):\n\n        module Main exposing (foo)\n\n        import Element\n\n        foo _ =\n            Element.text \"hi\"\n\n        --> AmbiguousModuleOwner\n        --    { moduleName = \"Element\"\n        --    , possiblePackages =\n        --        [ \"mdgriffith/elm-ui\"\n        --        , \"mdgriffith/style-elements\"\n        --        ]\n        --    }\n\n  - **`TypeMismatch`:**\n\n        module Main exposing (foo)\n\n        foo : Int\n        foo =\n            \"abc\"\n\n        --> TypeMismatch Type.Int Type.String\n\n  - **`InfiniteType`:**\n\n        module Main exposing (foo)\n\n        foo x =\n            x x\n\n        --> InfiniteType\n        --    (Type.TypeVar \"a\")\n        --    (Type.Function\n        --      { from = Type.TypeVar \"a\"\n        --      , to = Type.TypeVar \"b\"\n        --      }\n        --    )\n\n  - **`ConstraintMismatch`:**\n\n        module Main exposing (foo)\n\n        foo x =\n            x + \"a\"\n\n        --> ConstraintMismatch\n        --    (Type.TypeVar \"number\")\n        --    Type.String\n\n","args":[],"cases":[["ImpossibleExpr",["Elm.Syntax.Node.Node Elm.Syntax.Expression.Expression"]],["ImpossiblePattern",["Elm.Syntax.Node.Node Elm.Syntax.Pattern.Pattern"]],["ImpossibleType",["Elm.Syntax.TypeAnnotation.TypeAnnotation"]],["ImpossibleDocsType",["Elm.Type.Type"]],["MissingModuleName",[]],["ModuleNotFound",[]],["VarNotFound",["{ usedIn : Elm.Syntax.ModuleName.ModuleName, varName : Elm.TypeInference.Type.VarName }"]],["AmbiguousName",["{ usedIn : Elm.Syntax.ModuleName.ModuleName, varName : Elm.TypeInference.Type.VarName, possibleModules : List.List Elm.Syntax.ModuleName.ModuleName }"]],["AmbiguousModuleOwner",["{ moduleName : String.String, possiblePackages : List.List String.String }"]],["TypeMismatch",["Elm.TypeInference.Type.Type","Elm.TypeInference.Type.Type"]],["InfiniteType",["Elm.TypeInference.Type.Type","Elm.TypeInference.Type.Type"]],["ConstraintMismatch",["Elm.TypeInference.Type.Type","Elm.TypeInference.Type.Type"]]]}],"aliases":[{"name":"Error","comment":" A type inference error + location info.\n","args":[],"type":"{ moduleName : Elm.Syntax.ModuleName.ModuleName, declarationNames : List.List Elm.TypeInference.Type.VarName, details : Elm.TypeInference.Error.ErrorDetails }"}],"values":[{"name":"toString","comment":" Render an error for diagnostic output.\n","type":"Elm.TypeInference.Error.Error -> String.String"}],"binops":[]},{"name":"Elm.TypeInference.Type","comment":" A data structure representing the Elm types.\n\n_Note:_ This module is not named `Elm.Type` because that already exists in `elm/project-metadata-utils`.\n\n@docs Type, toString, toMultilineString, toTypeAnnotation\n@docs PackageName, VarName\n\n","unions":[{"name":"Type","comment":" The inferred type.\n","args":[],"cases":[["TypeVar",["String.String"]],["Function",["{ from : Elm.TypeInference.Type.Type, to : Elm.TypeInference.Type.Type }"]],["Int",[]],["Float",[]],["Char",[]],["String",[]],["Bool",[]],["List",["Elm.TypeInference.Type.Type"]],["Unit",[]],["Tuple2",["Elm.TypeInference.Type.Type","Elm.TypeInference.Type.Type"]],["Tuple3",["Elm.TypeInference.Type.Type","Elm.TypeInference.Type.Type","Elm.TypeInference.Type.Type"]],["Record",["{ fields : Dict.Dict String.String Elm.TypeInference.Type.Type }"]],["ExtensibleRecord",["{ fields : Dict.Dict String.String Elm.TypeInference.Type.Type, extensionTypevar : String.String }"]],["Named",["{ package : Elm.TypeInference.Type.PackageName, moduleName : Elm.Syntax.ModuleName.ModuleName, name : String.String, arguments : List.List Elm.TypeInference.Type.Type }"]],["WebGLShader",["{ attributesFields : Dict.Dict String.String Elm.TypeInference.Type.Type, attributesExtensionTypevar : Maybe.Maybe String.String, uniformsFields : Dict.Dict String.String Elm.TypeInference.Type.Type, uniformsExtensionTypevar : Maybe.Maybe String.String, varyingsFields : Dict.Dict String.String Elm.TypeInference.Type.Type, varyingsExtensionTypevar : Maybe.Maybe String.String }"]]]}],"aliases":[{"name":"PackageName","comment":" Eg. `\"elm/core\"`.\nComes from `elm.json` dependency keys.\n\nEmpty string for the user's project.\n\n","args":[],"type":"String.String"},{"name":"VarName","comment":" Eg. `\"foobar\"` in `\\foobar -> foobar + 1`.\n","args":[],"type":"String.String"}],"values":[{"name":"toMultilineString","comment":" Display a type, breaking it to new lines when the full type is longer than\n`maxWidth` chars.\n\nShort types stay on one line:\n\n    a -> b\n\nLong `->` chains break one arrow per line:\n\n    Foo bar baz\n    -> Foo bar baz\n    -> Foo bar baz\n\nLong records break one field per line:\n\n     { a : Int\n     , b : String\n     }\n\n","type":"Basics.Int -> Elm.TypeInference.Type.Type -> String.String"},{"name":"toString","comment":" Display a type.\n\n    toString (Function { from = Int, to = TypeVar \"a\" })\n    --> \"Int -> a\"\n\n","type":"Elm.TypeInference.Type.Type -> String.String"},{"name":"toTypeAnnotation","comment":" Convert a `Type` to an `elm-syntax` `TypeAnnotation`.\n\nAll `Node`s use dummy ranges.\n\n","type":"Elm.TypeInference.Type.Type -> Elm.Syntax.TypeAnnotation.TypeAnnotation"}],"binops":[]},{"name":"TypeLookupTable","comment":"\n\n@docs TypeLookupTable, get\n\n","unions":[],"aliases":[{"name":"TypeLookupTable","comment":" A lazy lookup table: after the initial collection of type equations is done\nin `Elm.TypeInference.inferModule`, we compute the type on demand when the user\ncalls `TypeLookupTable.get`.\n","args":[],"type":"TypeLookupTable.Internal.TypeLookupTable"}],"values":[{"name":"get","comment":" Look up the inferred `Type` for a source `Range`.\n\nOnly exact ranges given by `Node.range` of AST nodes inside the input\n`Elm.Syntax.File`s are recorded. There is no overlap matching.\n\n","type":"Elm.Syntax.Range.Range -> TypeLookupTable.TypeLookupTable -> ( Maybe.Maybe Elm.TypeInference.Type.Type, TypeLookupTable.TypeLookupTable )"}],"binops":[]}]