1module Compile (compile) where
3import qualified Data.Map as Map
5import qualified AST.Module as Module
7import qualified Parse.Helpers as Parse
8import qualified Parse.Parse as Parse
9import qualified Reporting.Error as Error
10import qualified Reporting.Task as Task
11import qualified Reporting.Warning as Warning
12import qualified Type.Inference as TI
13import qualified Transform.Canonicalize as Canonical
21 -> Task.Task Warning.Warning Error.Error Module.CanonicalModule
23compile user projectName interfaces source =
25 -- determine if default imports should be added
26 -- only elm-lang/core is exempt
28 not (user == "elm-lang" && projectName == "core")
30 -- Parse the source code
32 Task.mapError Error.Syntax $
33 Parse.program needsDefaults (getOpTable interfaces) source
35 -- Canonicalize all variables, pinning down where they came from.
37 Canonical.module' interfaces validModule
39 -- Run type inference on the program.
41 Task.from Error.Type $
42 TI.infer interfaces canonicalModule
44 -- Add the real list of tyes
45 let body = (Module.body canonicalModule) { Module.types = types }
47 return $ canonicalModule { Module.body = body }
50getOpTable :: Module.Interfaces -> Parse.OpTable
51getOpTable interfaces =
53 |> concatMap Module.iFixities
54 |> map (\(assoc,lvl,op) -> (op,(lvl,assoc)))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list