[{"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","args":["type_"],"cases":[["ExpressionUnit",[]],["ExpressionInteger",["{ base : ElmSyntaxTypeInfer.Base10Or16, value : Basics.Int }"]],["ExpressionFloat",["Basics.Float"]],["ExpressionString",["String.String"]],["ExpressionChar",["Char.Char"]],["ExpressionReference",["{ moduleOrigin : Elm.Syntax.ModuleName.ModuleName, qualification : Elm.Syntax.ModuleName.ModuleName, name : String.String }"]],["ExpressionOperatorFunction",["{ moduleOrigin : Elm.Syntax.ModuleName.ModuleName, symbol : String.String }"]],["ExpressionRecordAccessFunction",["String.String"]],["ExpressionNegation",["ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_"]],["ExpressionParenthesized",["ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_"]],["ExpressionTuple",["{ part0 : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_, part1 : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_ }"]],["ExpressionTriple",["{ part0 : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_, part1 : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_, part2 : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_ }"]],["ExpressionRecordAccess",["{ record : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_, fieldNameRange : Elm.Syntax.Range.Range, fieldName : String.String }"]],["ExpressionInfixOperation",["{ operator : { moduleOrigin : Elm.Syntax.ModuleName.ModuleName, symbol : String.String, type_ : type_ }, left : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_, right : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_ }"]],["ExpressionIfThenElse",["{ condition : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_, onTrue : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_, onFalse : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_ }"]],["ExpressionList",["List.List (ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_)"]],["ExpressionCall",["{ called : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_, argument0 : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_, argument1Up : List.List (ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_) }"]],["ExpressionRecord",["List.List { range : Elm.Syntax.Range.Range, name : String.String, nameRange : Elm.Syntax.Range.Range, value : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_ }"]],["ExpressionRecordUpdate",["{ recordVariable : ElmSyntaxTypeInfer.TypedNode { moduleOrigin : Elm.Syntax.ModuleName.ModuleName, name : String.String } type_, field0 : { range : Elm.Syntax.Range.Range, name : String.String, nameRange : Elm.Syntax.Range.Range, value : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_ }, field1Up : List.List { range : Elm.Syntax.Range.Range, name : String.String, nameRange : Elm.Syntax.Range.Range, value : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_ } }"]],["ExpressionLambda",["{ parameter0 : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_, parameter1Up : List.List (ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_), result : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_ }"]],["ExpressionCaseOf",["{ matchedExpression : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_, case0 : { pattern : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_, result : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_ }, case1Up : List.List { pattern : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_, result : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_ } }"]],["ExpressionLetIn",["{ declaration0 : { range : Elm.Syntax.Range.Range, declaration : ElmSyntaxTypeInfer.LetDeclaration type_ }, declaration1Up : List.List { range : Elm.Syntax.Range.Range, declaration : ElmSyntaxTypeInfer.LetDeclaration type_ }, result : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_ }"]]]},{"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":["type_"],"cases":[["LetDestructuring",["{ pattern : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_, expression : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_ }"]],["LetValueOrFunctionDeclaration",["{ signature : Maybe.Maybe { range : Elm.Syntax.Range.Range, nameRange : Elm.Syntax.Range.Range, annotationType : Elm.Syntax.TypeAnnotation.TypeAnnotation, annotationTypeRange : Elm.Syntax.Range.Range }, nameRange : Elm.Syntax.Range.Range, name : String.String, parameters : List.List (ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_), result : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression type_) type_, type_ : 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":["type_"],"cases":[["PatternIgnored",[]],["PatternVariable",["String.String"]],["PatternParenthesized",["ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_"]],["PatternAs",["{ pattern : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_, variable : ElmSyntaxTypeInfer.TypedNode String.String type_ }"]],["PatternUnit",[]],["PatternChar",["Char.Char"]],["PatternString",["String.String"]],["PatternInt",["{ base : ElmSyntaxTypeInfer.Base10Or16, value : Basics.Int }"]],["PatternTuple",["{ part0 : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_, part1 : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_ }"]],["PatternTriple",["{ part0 : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_, part1 : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_, part2 : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_ }"]],["PatternRecord",["List.List (ElmSyntaxTypeInfer.TypedNode String.String type_)"]],["PatternListCons",["{ head : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_, tail : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_ }"]],["PatternListExact",["List.List (ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_)"]],["PatternVariant",["{ moduleOrigin : Elm.Syntax.ModuleName.ModuleName, qualification : Elm.Syntax.ModuleName.ModuleName, name : String.String, values : List.List (ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern type_) type_) }"]]]},{"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\n","args":["variable"],"cases":[["TypeVariable",["variable"]],["TypeNotVariable",["ElmSyntaxTypeInfer.TypeNotVariable variable"]]]},{"name":"TypeNotVariable","comment":" [`Type`](#Type) except the variable case\n","args":["variable"],"cases":[["TypeUnit",[]],["TypeConstruct",["{ moduleOrigin : Elm.Syntax.ModuleName.ModuleName, name : String.String, arguments : List.List (ElmSyntaxTypeInfer.Type variable) }"]],["TypeTuple",["{ part0 : ElmSyntaxTypeInfer.Type variable, part1 : ElmSyntaxTypeInfer.Type variable }"]],["TypeTriple",["{ part0 : ElmSyntaxTypeInfer.Type variable, part1 : ElmSyntaxTypeInfer.Type variable, part2 : ElmSyntaxTypeInfer.Type variable }"]],["TypeRecord",["FastDict.Dict String.String (ElmSyntaxTypeInfer.Type variable)"]],["TypeRecordExtension",["{ recordVariable : variable, fields : FastDict.Dict String.String (ElmSyntaxTypeInfer.Type variable) }"]],["TypeFunction",["{ input : ElmSyntaxTypeInfer.Type variable, output : ElmSyntaxTypeInfer.Type variable }"]]]}],"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 ( Elm.Syntax.ModuleName.ModuleName, String.String ) Elm.Syntax.ModuleName.ModuleName, typeConstructs : FastDict.Dict ( Elm.Syntax.ModuleName.ModuleName, String.String ) Elm.Syntax.ModuleName.ModuleName, 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 String.String), typeAliases : FastDict.Dict String.String { parameters : List.List String.String, type_ : ElmSyntaxTypeInfer.Type String.String, 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 String.String)) } }"},{"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_"],"type":"{ range : Elm.Syntax.Range.Range, value : value, type_ : type_ }"}],"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 Elm.Syntax.ModuleName.ModuleName ElmSyntaxTypeInfer.ModuleTypes"},{"name":"importsToModuleOriginLookup","comment":" Calculate valid mappings of qualifications + name\nto origin module based on a module's imports.\n\nRequires all exposed [`ModuleTypes`](#ModuleTypes)\nso we can resolve `exposing (..)` and `ChoiceType(..)`.\n\n","type":"FastDict.Dict Elm.Syntax.ModuleName.ModuleName 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":"ElmSyntaxTypeInfer.ModuleOriginLookup -> List.List 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        (FastDict.singleton \"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":"{ importedTypes : FastDict.Dict Elm.Syntax.ModuleName.ModuleName ElmSyntaxTypeInfer.ModuleTypes, moduleOriginLookup : ElmSyntaxTypeInfer.ModuleOriginLookup, otherModuleDeclaredTypes : ElmSyntaxTypeInfer.ModuleTypes } -> List.List Elm.Syntax.Expression.Function -> Result.Result String.String (FastDict.Dict String.String { parameters : List.List (ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Pattern (ElmSyntaxTypeInfer.Type String.String)) (ElmSyntaxTypeInfer.Type String.String)), result : ElmSyntaxTypeInfer.TypedNode (ElmSyntaxTypeInfer.Expression (ElmSyntaxTypeInfer.Type String.String)) (ElmSyntaxTypeInfer.Type String.String), type_ : ElmSyntaxTypeInfer.Type 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":[]}]