1{-# OPTIONS_GHC -Wall -fno-warn-unused-do-bind #-}
2module Compile (compile) where
4import qualified AST.Expression.Canonical as Can
5import qualified AST.Module as Module
6import qualified AST.Module.Name as ModuleName
7import qualified Canonicalize
8import qualified Elm.Package as Package
9import qualified Nitpick.PatternMatches as Nitpick
10import qualified Nitpick.TopLevelTypes as Nitpick
11import qualified Optimize
12import qualified Parse.Parse as Parse (program)
13import qualified Reporting.Error as Error
14import qualified Reporting.Render.Type as RenderType
15import qualified Reporting.Result as Result
16import qualified Reporting.Warning as Warning
17import qualified Type.Inference as TI
22 Result.Result (Result.One RenderType.Localizer) Warning.Warning Error.Error
27 -> [ModuleName.Canonical]
30 -> Result Module.Optimized
31compile packageName canonicalImports interfaces source =
33 -- Parse the source code
35 Result.format Error.Syntax $
36 {-# SCC elm_compiler_parse #-}
37 Parse.program packageName source
39 -- Canonicalize all variables, pinning down where they came from.
41 {-# SCC elm_compiler_canonicalize #-}
42 Canonicalize.module' canonicalImports interfaces validModule
44 -- Run type inference on the program.
46 Result.from Error.Type $
47 {-# SCC elm_compiler_types #-}
48 TI.infer interfaces canonicalModule
50 -- One last round of checks
52 Result.format Error.Type $
53 {-# SCC elm_compiler_nitpick #-}
54 Nitpick.topLevelTypes types $
55 Can.toSortedDefs (Module.program (Module.info canonicalModule))
58 Result.format Error.Pattern $
59 {-# SCC elm_compiler_exhaustiveness #-}
60 Nitpick.patternMatches interfaces canonicalModule
62 -- Do some basic optimizations
64 {-# SCC elm_compiler_optimization #-}
65 Optimize.optimize tagDict (Module.name canonicalModule) canonicalDefs
67 -- Add the real list of types
69 (Module.info canonicalModule)
70 { Module.types = types
71 , Module.program = optimisedDefs
74 return $ canonicalModule { Module.info = info }
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