1module Compile (compile) where
3import qualified Data.Map as Map
5import qualified AST.Module as Module
6import qualified AST.Module.Name as ModuleName
7import qualified Canonicalize
9import qualified Elm.Package as Package
10import qualified Nitpick.PatternMatches as Nitpick
11import qualified Nitpick.TopLevelTypes as Nitpick
12import qualified Optimize
13import qualified Parse.Helpers as Parse
14import qualified Parse.Parse as Parse
15import qualified Reporting.Error as Error
16import qualified Reporting.Result as Result
17import qualified Reporting.Warning as Warning
18import qualified Type.Inference as TI
24 -> [ModuleName.Canonical]
27 -> Result.Result Warning.Warning Error.Error Module.Optimized
29compile packageName isRoot canonicalImports interfaces source =
31 -- Parse the source code
33 Result.mapError Error.Syntax $
34 Parse.program packageName isRoot (getOpTable interfaces) source
36 -- Canonicalize all variables, pinning down where they came from.
38 Canonicalize.module' canonicalImports interfaces validModule
40 -- Run type inference on the program.
42 Result.from Error.Type $
43 TI.infer interfaces canonicalModule
45 -- One last round of checks
46 Result.mapError Error.Type $
47 Nitpick.topLevelTypes types (Module.body validModule)
50 Result.mapError Error.Pattern $
51 Nitpick.patternMatches interfaces canonicalModule
53 -- Add the real list of types
55 (Module.body canonicalModule) { Module.types = types }
57 -- Do some basic optimizations
59 Optimize.optimize tagDict (canonicalModule { Module.body = body })
64getOpTable :: Module.Interfaces -> Parse.OpTable
65getOpTable interfaces =
67 |> concatMap Module.iFixities
68 |> 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