1{-# OPTIONS_GHC -Wall -fno-warn-unused-do-bind #-}
2module Compile (compile) where
7import qualified AST.Expression.Canonical as Can
8import qualified AST.Module as Module
9import qualified AST.Module.Name as ModuleName
10import qualified Canonicalize
11import qualified Elm.Package as Package
12import qualified Nitpick.PatternMatches as Nitpick
13import qualified Nitpick.TopLevelTypes as Nitpick
14import qualified Optimize
15import qualified Parse.Parse as Parse (program)
16import qualified Reporting.Error as Error
17import qualified Reporting.Render.Type as RenderType
18import qualified Reporting.Result as Result
19import qualified Reporting.Warning as Warning
20import qualified Type.Inference as TI
28 Result.Result (Result.One RenderType.Localizer) Warning.Warning Error.Error
33 -> Map ModuleName.Raw ModuleName.Canonical
36 -> Result Module.Optimized
37compile packageName importDict interfaces source =
39 -- Parse the source code
41 Result.format Error.Syntax $
42 {-# SCC elm_compiler_parse #-}
43 Parse.program packageName source
45 -- Canonicalize all variables, pinning down where they came from.
47 {-# SCC elm_compiler_canonicalize #-}
48 Canonicalize.module' importDict interfaces validModule
50 -- Run type inference on the program.
52 Result.from Error.Type $
53 {-# SCC elm_compiler_types #-}
54 TI.infer interfaces canonicalModule
56 -- One last round of checks
58 Result.format Error.Type $
59 {-# SCC elm_compiler_nitpick #-}
60 Nitpick.topLevelTypes types $
61 Can.toSortedDefs (Module.program (Module.info canonicalModule))
64 Result.format Error.Pattern $
65 {-# SCC elm_compiler_exhaustiveness #-}
66 Nitpick.patternMatches interfaces canonicalModule
68 -- Do some basic optimizations
70 {-# SCC elm_compiler_optimization #-}
71 Optimize.optimize tagDict (Module.name canonicalModule) canonicalDefs
73 -- Add the real list of types
75 (Module.info canonicalModule)
76 { Module.types = types
77 , Module.program = optimisedDefs
80 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