Infer types of elm-syntax AST.
-- A contrived example, normally this would live split out
-- inside `update` Msg handlers, state saved into Model, etc.
Elm.TypeInference.init
{ directDependencies = ["elm/core"]
, allDependencies = [...] -- Parsed from ~/.elm files
, sourcesToResolveAmbiguity = Dict.empty
, projectPackageName = Just "my/package-name"
, projectFiles = [ parsedFile ]
}
--> Ok project
Elm.TypeInference.getType
["MyModule","Internal"]
someRange
project
--> ( Ok someType, newProject )
-- Can be later "printed" with `Elm.TypeInference.Type.toString someType`
Elm.TypeInference.addFile updatedFile project
--> Ok newerProject
Elm.TypeInference.removeFile ["MyModule","Internal"] project
--> newerProjectIf init fails with Err (ProjectError.NeedPackageSources needed), read and parse
them and retry with them added to the sourcesToResolveAmbiguity field.