[{"name":"ElmSyntaxTypeInfer","comment":" Add type information to the nodes\nof an [elm-syntax](https://dark.elm.dmy.fr/packages/stil4m/elm-syntax/latest/) tree.\n\n@docs valueAndFunctionDeclarations\n\n## context\n\n@docs ModuleTypes, elmCoreTypes, moduleDeclarationsToTypes, moduleInterfaceToTypes\n@docs ModuleOriginLookup, importsToModuleOriginLookup\n\n\n## syntax\n\n@docs TypedNode, Expression, LetDeclaration, Pattern, Base10Or16\n@docs Type, TypeNotVariable\n\nIf you are interested in exposing helpers like `expressionMapType`,\n[open an issue](https://github.com/lue-bird/elm-syntax-type-infer/issues/new)\n\n","unions":[{"name":"Base10Or16","comment":" Either decimal or hexadecimal.\nUsed by [`PatternInt`](#Pattern) and [`ExpressionInteger`](#Expression)\n","args":[],"cases":[["Base10",[]],["Base16",[]]]},{"name":"Expression","comment":" Like [`Elm.Syntax.Expression.Expression`](https://dark.elm.dmy.fr/packages/stil4m/elm-syntax/latest/Elm-Syntax-Expression#Expression)\nbut its sub-nodes are [`TypedNode`](#TypedNode)s.\n\nBe aware when trying to match references that they are split into multiple variants:\n  - `ExpressionReference` (for let/module declared value/function or port or pattern variable use)\n  - `ExpressionReferenceVariant`\n  - `ExpressionReferenceRecordTypeAliasConstructorFunction`\n\n","args":[],"cases":[["ExpressionUnit",[]],["ExpressionInteger",["{ base : ElmSyntaxTypeInfer.Base10Or16, value : Basics.Int }"]],["ExpressionFloat",["Basics.Float"]],["ExpressionString",["String.String"]],["ExpressionChar",["Char.Char"]],["ExpressionReference",["{ moduleOrigin : String.String, qualification : String.String, name : String.String }"]],["ExpressionReferenceVariant",["{ moduleOrigin : String.String, choiceTypeName : String.String, qualification : String.String, name : String.String }"]],["ExpressionReferenceRecordTypeAliasConstructorFunction",["{ moduleOrigin : String.String, qualification : String.String, name : String.String }"]],["ExpressionOperatorFunction",["{ moduleOrigin : String.String, symbol : String.String }"]],["ExpressionRecordAccessFunction",["String.String"]],["ExpressionNegation",["ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression"]],["ExpressionParenthesized",["ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression"]],["ExpressionTuple",["{ part0 : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression, part1 : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression }"]],["ExpressionTriple",["{ part0 : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression, part1 : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression, part2 : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression }"]],["ExpressionRecordAccess",["{ record : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression, fieldNameRange : Elm.Syntax.Range.Range, fieldName : String.String }"]],["ExpressionInfixOperation",["{ operator : { moduleOrigin : String.String, symbol : String.String, type_ : ElmSyntaxTypeInfer.Type }, left : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression, right : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression }"]],["ExpressionIfThenElse",["{ condition : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression, onTrue : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression, onFalse : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression }"]],["ExpressionList",["List.List (ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression)"]],["ExpressionCall",["{ called : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression, argument0 : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression, argument1Up : List.List (ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression) }"]],["ExpressionRecord",["List.List { range : Elm.Syntax.Range.Range, name : String.String, nameRange : Elm.Syntax.Range.Range, value : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression }"]],["ExpressionRecordUpdate",["{ recordVariable : ElmSyntaxTypeInfer.TypedNode { moduleOrigin : String.String, name : String.String }, field0 : { range : Elm.Syntax.Range.Range, name : String.String, nameRange : Elm.Syntax.Range.Range, value : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression }, field1Up : List.List { range : Elm.Syntax.Range.Range, name : String.String, nameRange : Elm.Syntax.Range.Range, value : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression } }"]],["ExpressionLambda",["{ parameter0 : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern, parameter1Up : List.List (ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern), result : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression }"]],["ExpressionCaseOf",["{ matched : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression, case0 : { pattern : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern, result : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression }, case1Up : List.List { pattern : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern, result : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression } }"]],["ExpressionLetIn",["{ declaration0 : { range : Elm.Syntax.Range.Range, declaration : ElmSyntaxTypeInfer.LetDeclaration }, declaration1Up : List.List { range : Elm.Syntax.Range.Range, declaration : ElmSyntaxTypeInfer.LetDeclaration }, result : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression }"]]]},{"name":"LetDeclaration","comment":" Like [`Elm.Syntax.Expression.LetDeclaration`](https://dark.elm.dmy.fr/packages/stil4m/elm-syntax/latest/Elm-Syntax-Expression#LetDeclaration)\nbut its sub-nodes are [`TypedNode`](#TypedNode)s\n","args":[],"cases":[["LetDestructuring",["{ pattern : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern, expression : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression }"]],["LetValueOrFunctionDeclaration",["{ name : String.String, nameRange : Elm.Syntax.Range.Range, signature : Maybe.Maybe { range : Elm.Syntax.Range.Range, nameRange : Elm.Syntax.Range.Range, annotationType : Elm.Syntax.TypeAnnotation.TypeAnnotation, annotationTypeRange : Elm.Syntax.Range.Range }, parameters : List.List (ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern), result : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression, type_ : ElmSyntaxTypeInfer.Type }"]]]},{"name":"Pattern","comment":" Like [`Elm.Syntax.Pattern.Pattern`](https://dark.elm.dmy.fr/packages/stil4m/elm-syntax/latest/Elm-Syntax-Pattern#Pattern)\nbut all its sub-nodes are [`TypedNode`](#TypedNode)s\n","args":[],"cases":[["PatternIgnored",[]],["PatternVariable",["String.String"]],["PatternParenthesized",["ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern"]],["PatternAs",["{ pattern : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern, variable : ElmSyntaxTypeInfer.TypedNode String.String }"]],["PatternUnit",[]],["PatternChar",["Char.Char"]],["PatternString",["String.String"]],["PatternInt",["{ base : ElmSyntaxTypeInfer.Base10Or16, value : Basics.Int }"]],["PatternTuple",["{ part0 : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern, part1 : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern }"]],["PatternTriple",["{ part0 : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern, part1 : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern, part2 : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern }"]],["PatternRecord",["List.List (ElmSyntaxTypeInfer.TypedNode String.String)"]],["PatternListCons",["{ head : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern, tail : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern }"]],["PatternListExact",["List.List (ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern)"]],["PatternVariant",["{ moduleOrigin : String.String, choiceTypeName : String.String, qualification : String.String, name : String.String, values : List.List (ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern) }"]]]},{"name":"Type","comment":" Type information attached to expressions and patterns,\nsee [`TypedNode`](#TypedNode).\n\nThis is different from [`Elm.Syntax.TypeAnnotation.TypeAnnotation`](https://dark.elm.dmy.fr/packages/stil4m/elm-syntax/latest/Elm-Syntax-TypeAnnotation#TypeAnnotation)\nin that it doesn't contain\ninformation unrelated to type inference like ranges, qualification levels or parens.\n\nImportantly, it also contains the overarching range\nof all places where each specific type variable is used.\nThis is useful to for example find out whether a variable in a let declaration type\nis \"forall\" or inherited from the surrounding context\n(if the use range is fully included in the let declaration range it's forall, otherwise inherited).\n\n","args":[],"cases":[["TypeVariable",["{ useRange : Elm.Syntax.Range.Range, name : String.String }"]],["TypeNotVariable",["ElmSyntaxTypeInfer.TypeNotVariable"]]]},{"name":"TypeNotVariable","comment":" [`Type`](#Type) except the variable case\n","args":[],"cases":[["TypeUnit",[]],["TypeConstruct",["{ moduleOrigin : String.String, name : String.String, arguments : List.List ElmSyntaxTypeInfer.Type }"]],["TypeTuple",["{ part0 : ElmSyntaxTypeInfer.Type, part1 : ElmSyntaxTypeInfer.Type }"]],["TypeTriple",["{ part0 : ElmSyntaxTypeInfer.Type, part1 : ElmSyntaxTypeInfer.Type, part2 : ElmSyntaxTypeInfer.Type }"]],["TypeRecord",["FastDict.Dict String.String ElmSyntaxTypeInfer.Type"]],["TypeRecordExtension",["{ recordVariable : { useRange : Elm.Syntax.Range.Range, name : String.String }, fields : FastDict.Dict String.String ElmSyntaxTypeInfer.Type }"]],["TypeFunction",["{ input : ElmSyntaxTypeInfer.Type, output : ElmSyntaxTypeInfer.Type }"]]]}],"aliases":[{"name":"ModuleOriginLookup","comment":" How to map names and symbols used in a module to their origin module.\nCreate with [`importsToModuleOriginLookup`](#importsToModuleOriginLookup).\n\nContains variants, type alias names, choice type names, port names, value/function declaration names\nand whether `(|.)` and or `(|=)` are imported from `Parser.Advanced`.\n\nAlso contains locally declared names when available.\n\nType- and expression/pattern-level members\nare separated since you can for example have a local `List` variant\nwhile also using an (implicitly) imported `List` type.\n\n","args":[],"type":"{ references : FastDict.Dict String.String (FastDict.Dict String.String String.String), typeConstructs : FastDict.Dict String.String (FastDict.Dict String.String String.String), keepOperatorIsExposedFromParserAdvanced : Basics.Bool, ignoreOperatorIsExposedFromParserAdvanced : Basics.Bool }"},{"name":"ModuleTypes","comment":" Known types of members in a module.\nCreate with [`moduleDeclarationsToTypes`](#moduleDeclarationsToTypes)\nand [`moduleInterfaceToTypes`](#moduleInterfaceToTypes)\n","args":[],"type":"{ signatures : FastDict.Dict String.String ElmSyntaxTypeInfer.Type, typeAliases : FastDict.Dict String.String { parameters : List.List String.String, type_ : ElmSyntaxTypeInfer.Type, recordFieldOrder : Maybe.Maybe (List.List String.String) }, choiceTypes : FastDict.Dict String.String { parameters : List.List String.String, variants : FastDict.Dict String.String (List.List ElmSyntaxTypeInfer.Type) } }"},{"name":"TypedNode","comment":" A part in the syntax tree with an attached\n\n  - [range](https://dark.elm.dmy.fr/packages/stil4m/elm-syntax/latest/Elm-Syntax-Range#Range) in the source\n  - global [`Type`](#Type): concretely inferred,\n    influenced by other branches and value/function (let) declaration type annotations\n\n","args":["value"],"type":"{ range : Elm.Syntax.Range.Range, type_ : ElmSyntaxTypeInfer.Type, value : value }"}],"values":[{"name":"elmCoreTypes","comment":" [`ModuleTypes`](#ModuleTypes) exposed in `elm/core`.\n\nPlease _always_ start with [`elmCoreTypes`](#elmCoreTypes)\nand add further module info with [`FastDict.union`](https://dark.elm.dmy.fr/packages/miniBill/elm-fast-dict/latest/FastDict#union)\nusing [`moduleDeclarationsToTypes`](#moduleDeclarationsToTypes)\nand [`moduleInterfaceToTypes`](#moduleInterfaceToTypes)\n\nAnd if for some reason you already know used dependencies at compile time,\nyou can re-use the [code generator used for these elm/core types](https://github.com/lue-bird/elm-syntax-type-infer/tree/main/codegen)\n\n","type":"FastDict.Dict String.String ElmSyntaxTypeInfer.ModuleTypes"},{"name":"importsToModuleOriginLookup","comment":" Calculate valid mappings of qualifications + name\nto origin module based on a module's imports, see [`ModuleOriginLookup`](#ModuleOriginLookup).\n\nRequires all exposed [`ModuleTypes`](#ModuleTypes)\nso we can resolve `exposing (..)` and `ChoiceType(..)`.\n\n","type":"FastDict.Dict String.String ElmSyntaxTypeInfer.ModuleTypes -> List.List (Elm.Syntax.Node.Node Elm.Syntax.Import.Import) -> ElmSyntaxTypeInfer.ModuleOriginLookup"},{"name":"moduleDeclarationsToTypes","comment":" Extract all known types\nfrom declarations within a module.\nUn-annotated value/function declarations are ignored.\n\nFor dependency modules, use [`moduleInterfaceToTypes`](#moduleInterfaceToTypes)\n\n","type":"{ moduleOriginLookup : ElmSyntaxTypeInfer.ModuleOriginLookup, moduleName : String.String } -> List.List (Elm.Syntax.Node.Node Elm.Syntax.Declaration.Declaration) -> { types : ElmSyntaxTypeInfer.ModuleTypes, errors : List.List String.String }"},{"name":"moduleInterfaceToTypes","comment":" Extract all known types\nfrom module [metadata](https://dark.elm.dmy.fr/packages/elm/project-metadata-utils/latest/),\nusually from parsing the `docs.json` of a dependency.\n\nFor elm-syntax modules, use [`moduleDeclarationsToTypes`](#moduleDeclarationsToTypes)\n\n","type":"Elm.Docs.Module -> { types : ElmSyntaxTypeInfer.ModuleTypes, errors : List.List String.String }"},{"name":"valueAndFunctionDeclarations","comment":" Infer types of\nvalue/[`Elm.Syntax.Expression.Function`](https://dark.elm.dmy.fr/packages/stil4m/elm-syntax/latest/Elm-Syntax-Expression#Function) declarations\nin a module.\n\n    import Elm.Syntax.Node\n    import Elm.Syntax.Expression\n    import ElmSyntaxTypeInfer\n\n\n    [ { declaration =\n            Elm.Syntax.Node.empty\n                { name = Elm.Syntax.Node.empty \"hello\"\n                , expression =\n                    Elm.Syntax.Node.empty\n                        (Elm.Syntax.Expression.Literal \"world\")\n                , arguments = []\n                }\n      , signature = Nothing\n      , documentation = Nothing\n      }\n    ]\n        |> ElmSyntaxTypeInfer.valueAndFunctionDeclarations\n            { importedTypes = ElmSyntaxTypeInfer.elmCoreTypes\n            , moduleOriginLookup = exampleModuleOriginLookup\n            , otherModuleDeclaredTypes =\n                []\n                    |> ElmSyntaxTypeInfer.moduleDeclarationsToTypes\n                        exampleModuleOriginLookup\n                    |> .types\n            }\n    -->\n    Ok\n        [ { name = \"hello\"\n          , type_ =\n                ElmSyntaxTypeInfer.TypeNotVariable\n                    (ElmSyntaxTypeInfer.TypeConstruct\n                        { moduleOrigin = [ \"String\" ], name = \"String\", arguments = [] }\n                    )\n          ...\n          }\n        ]\n\n\n    exampleModuleOriginLookup : ElmSyntaxTypeInfer.ModuleOriginLookup\n    exampleModuleOriginLookup =\n        []\n            |> ElmSyntaxTypeInfer.importsToModuleOriginLookup\n                ElmSyntaxTypeInfer.elmCoreTypes\n\nSee [`ModuleTypes`](#ModuleTypes) and [`ModuleOriginLookup`](#ModuleOriginLookup)\n\nWarning! Always first verify that provided type alias declarations aren't (mutually) recursive.\nOtherwise this function might never terminate.\n\n","type":"{ moduleName : String.String, importedTypes : FastDict.Dict String.String ElmSyntaxTypeInfer.ModuleTypes, moduleOriginLookup : ElmSyntaxTypeInfer.ModuleOriginLookup, otherModuleDeclaredTypes : ElmSyntaxTypeInfer.ModuleTypes } -> List.List Elm.Syntax.Expression.Function -> Result.Result String.String (List.List { parameters : List.List (ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Pattern), result : ElmSyntaxTypeInfer.TypedNode ElmSyntaxTypeInfer.Expression, type_ : ElmSyntaxTypeInfer.Type, name : String.String, nameRange : Elm.Syntax.Range.Range, documentation : Maybe.Maybe { content : String.String, range : Elm.Syntax.Range.Range }, signature : Maybe.Maybe { range : Elm.Syntax.Range.Range, nameRange : Elm.Syntax.Range.Range, annotationTypeRange : Elm.Syntax.Range.Range, annotationType : Elm.Syntax.TypeAnnotation.TypeAnnotation } })"}],"binops":[]}]