on master help sign in
Get all of the Haskell files compiling with the new type checker.
cb914d9Evan Czaplicki
Elm.cabal+39−26
@@ -34,14 +34,16 @@ Library
34 Language.Elm.Quasi
34 Language.Elm.Quasi
35 Hs-Source-Dirs: compiler
35 Hs-Source-Dirs: compiler
36 other-modules: Unique,
36 other-modules: Unique,
37+ SourceSyntax.Declaration,
38+ SourceSyntax.Expression,
39+ SourceSyntax.Everything,
37 SourceSyntax.Helpers,
40 SourceSyntax.Helpers,
38− SourceSyntax.Location,
39 SourceSyntax.Literal,
41 SourceSyntax.Literal,
40− SourceSyntax.Pattern,
42+ SourceSyntax.Location,
41− SourceSyntax.Expression,
42− SourceSyntax.Declaration,
43 SourceSyntax.Module,
43 SourceSyntax.Module,
44− SourceSyntax.Rename
44+ SourceSyntax.Pattern,
45+ SourceSyntax.Rename,
46+ SourceSyntax.Type,
45 Generate.JavaScript,
47 Generate.JavaScript,
46 Generate.Noscript,
48 Generate.Noscript,
47 Generate.Html,
49 Generate.Html,
@@ -52,21 +54,24 @@ Library
52 Metadata.LoadLibraries,
54 Metadata.LoadLibraries,
53 Initialize,
55 Initialize,
54 Parse.Binop,
56 Parse.Binop,
57+ Parse.Declaration,
55 Parse.Expression,
58 Parse.Expression,
56− Parse.Foreign,
57 Parse.Helpers,
59 Parse.Helpers,
58 Parse.Literal,
60 Parse.Literal,
59 Parse.Module,
61 Parse.Module,
60 Parse.Parser,
62 Parse.Parser,
61 Parse.Pattern,
63 Parse.Pattern,
62 Parse.Type,
64 Parse.Type,
63− Types.Alias,
65+ Type.Constrain.Declaration,
64− Types.Types,
66+ Type.Constrain.Expression,
67+ Type.Constrain.Literal,
65− Types.Constrain,
68+ Type.Constrain.Pattern,
66− Types.Hints,
69+ Type.Environment,
67− Types.Solver,
70+ Type.Fragment,
68− Types.Substitutions,
71+ Type.Solve,
72+ Type.State,
73+ Type.Type,
69− Types.Unify,
74+ Type.Unify,
70 Paths_Elm
75 Paths_Elm
71
76
72 Build-depends: base >=4.2 && <5,
77 Build-depends: base >=4.2 && <5,
@@ -84,6 +89,7 @@ Library
84 mtl >= 2,
89 mtl >= 2,
85 pandoc >= 1.10,
90 pandoc >= 1.10,
86 parsec >= 3.1.1,
91 parsec >= 3.1.1,
92+ pretty,
87 shakespeare,
93 shakespeare,
88 text,
94 text,
89 template-haskell,
95 template-haskell,
@@ -95,14 +101,16 @@ Executable elm
95 Main-is: Compiler.hs
101 Main-is: Compiler.hs
96 Hs-Source-Dirs: compiler
102 Hs-Source-Dirs: compiler
97 other-modules: Unique,
103 other-modules: Unique,
104+ SourceSyntax.Declaration,
105+ SourceSyntax.Expression,
106+ SourceSyntax.Everything,
98 SourceSyntax.Helpers,
107 SourceSyntax.Helpers,
99− SourceSyntax.Location,
100 SourceSyntax.Literal,
108 SourceSyntax.Literal,
101− SourceSyntax.Pattern,
109+ SourceSyntax.Location,
102− SourceSyntax.Expression,
103− SourceSyntax.Declaration,
104 SourceSyntax.Module,
110 SourceSyntax.Module,
105− SourceSyntax.Rename
111+ SourceSyntax.Pattern,
112+ SourceSyntax.Rename,
113+ SourceSyntax.Type,
106 Generate.JavaScript,
114 Generate.JavaScript,
107 Generate.Noscript,
115 Generate.Noscript,
108 Generate.Html,
116 Generate.Html,
@@ -113,21 +121,24 @@ Executable elm
113 Metadata.LoadLibraries,
121 Metadata.LoadLibraries,
114 Initialize,
122 Initialize,
115 Parse.Binop,
123 Parse.Binop,
124+ Parse.Declaration,
116 Parse.Expression,
125 Parse.Expression,
117− Parse.Foreign,
118 Parse.Helpers,
126 Parse.Helpers,
119 Parse.Literal,
127 Parse.Literal,
120 Parse.Module,
128 Parse.Module,
121 Parse.Parser,
129 Parse.Parser,
122 Parse.Pattern,
130 Parse.Pattern,
123 Parse.Type,
131 Parse.Type,
124− Types.Alias,
132+ Type.Constrain.Declaration,
125− Types.Types,
133+ Type.Constrain.Expression,
134+ Type.Constrain.Literal,
126− Types.Constrain,
135+ Type.Constrain.Pattern,
127− Types.Hints,
136+ Type.Environment,
128− Types.Solver,
137+ Type.Fragment,
129− Types.Substitutions,
138+ Type.Solve,
139+ Type.State,
140+ Type.Type,
130− Types.Unify,
141+ Type.Unify,
131 Paths_Elm
142 Paths_Elm
132
143
133 Build-depends: base >=4.2 && <5,
144 Build-depends: base >=4.2 && <5,
@@ -145,6 +156,7 @@ Executable elm
145 mtl >= 2,
156 mtl >= 2,
146 pandoc >= 1.10,
157 pandoc >= 1.10,
147 parsec >= 3.1.1,
158 parsec >= 3.1.1,
159+ pretty,
148 transformers >= 0.2,
160 transformers >= 0.2,
149 union-find,
161 union-find,
150 uniplate
162 uniplate
@@ -169,6 +181,7 @@ Executable elm-doc
169 mtl >= 2,
181 mtl >= 2,
170 parsec >= 3.1.1,
182 parsec >= 3.1.1,
171 pandoc >= 1.10,
183 pandoc >= 1.10,
184+ pretty,
172 cmdargs,
185 cmdargs,
173 filepath,
186 filepath,
174 indents
187 indents
compiler/Docs.hs+5−6
@@ -4,16 +4,13 @@ module Main where
4import SourceSyntax.Declaration (Declaration(Datatype))
4import SourceSyntax.Declaration (Declaration(Datatype))
5import Control.Applicative ((<$>), (<*>))
5import Control.Applicative ((<$>), (<*>))
6import Data.List (intercalate)
6import Data.List (intercalate)
7−import Data.Maybe (catMaybes)
8−import Types.Types ((==>), Type ( ADT, VarT ) )
9−import Parse.Type (datatype)
7+import Parse.Type
10import Parse.Helpers
8import Parse.Helpers
11import Parse.Module (moduleDef)
9import Parse.Module (moduleDef)
12import Text.Parsec hiding (newline,spaces)
10import Text.Parsec hiding (newline,spaces)
13import System.Environment
11import System.Environment
14import System.Exit
12import System.Exit
15
13
16−
17main = do
14main = do
18 srcs <- mapM readFile =<< getArgs
15 srcs <- mapM readFile =<< getArgs
19 case mapM docParse srcs of
16 case mapM docParse srcs of
@@ -64,11 +61,13 @@ annotation exports =
64
61
65 typeDef = lookAhead ((string "data" <|> string "type") >> whitespace >> capVar)
62 typeDef = lookAhead ((string "data" <|> string "type") >> whitespace >> capVar)
66
63
67− adt = do
64+ adt = do undefined
65+{-- TODO: reimplement this
68 (Datatype name tvs constructors) <- datatype
66 (Datatype name tvs constructors) <- datatype
69 let toType (cName, typeArgs) =
67 let toType (cName, typeArgs) =
70− (cName, show $ foldr (==>) (ADT name $ map VarT tvs) typeArgs, "")
68+ (cName, show $ foldr (==>) (kADT name $ map kVarT tvs) typeArgs, "")
71 return $ map toType constructors
69 return $ map toType constructors
70+--}
72
71
73setupParser p source =
72setupParser p source =
74 case iParse p "" source of
73 case iParse p "" source of
compiler/Generate/JavaScript.hs−1
@@ -14,7 +14,6 @@ import Generate.Cases
14import SourceSyntax.Everything hiding (parens)
14import SourceSyntax.Everything hiding (parens)
15import SourceSyntax.Location as Loc
15import SourceSyntax.Location as Loc
16import Transform.SortDefinitions
16import Transform.SortDefinitions
17−import Types.Types ( Type(RecordT) )
18
17
19showErr :: String -> String
18showErr :: String -> String
20showErr err = globalAssign "Elm.Main" (jsFunc "elm" body)
19showErr err = globalAssign "Elm.Main" (jsFunc "elm" body)
compiler/Initialize.hs+11−4
@@ -9,14 +9,21 @@ import SourceSyntax.Everything
9import Data.List (intercalate,partition)
9import Data.List (intercalate,partition)
10import Parse.Parser (parseProgram, parseDependencies)
10import Parse.Parser (parseProgram, parseDependencies)
11import qualified Metadata.Libraries as Libs
11import qualified Metadata.Libraries as Libs
12−import Types.Types ((-:))
13−import Types.Hints (hints)
14−import Types.Unify (unify)
15−import Types.Alias (dealias, mistakes)
16import Transform.Optimize
12import Transform.Optimize
17import System.Exit
13import System.Exit
18import System.FilePath
14import System.FilePath
19
15
16+
17+{-- TODO: replace with new stuff
18+import Types.Hints (hints)
19+import Types.Unify (unify)
20+import Types.Alias (dealias, mistakes)
21+--}
22+mistakes = undefined
23+unify = undefined
24+hints = undefined
25+
26+
20checkMistakes :: (Data t, Data v) => Module t v -> Either String (Module t v)
27checkMistakes :: (Data t, Data v) => Module t v -> Either String (Module t v)
21checkMistakes modul@(Module name ex im stmts) =
28checkMistakes modul@(Module name ex im stmts) =
22 case mistakes stmts of
29 case mistakes stmts of
compiler/Type/State.hs+2−2
@@ -165,10 +165,10 @@ restore alreadyCopied variable = do
165 debug $ putStr "Restoring: "
165 debug $ putStr "Restoring: "
166 desc <- liftIO $ UF.descriptor variable
166 desc <- liftIO $ UF.descriptor variable
167 if mark desc /= alreadyCopied
167 if mark desc /= alreadyCopied
168− then do
168+ then do
169 debug $ putStrLn "not copied, no need to do anything"
169 debug $ putStrLn "not copied, no need to do anything"
170 return variable
170 return variable
171− else do
171+ else do
172 debug $ putStrLn "restoring"
172 debug $ putStrLn "restoring"
173 restoredStructure <-
173 restoredStructure <-
174 case structure desc of
174 case structure desc of