on master help sign in
Get all of the Haskell files compiling with the new type checker.

Does not actually work, undefined is used in some places as a stopgap measure.

commitcb914d91ffcd2612c321b9c33864ceb8dfb7ab24 authorEvan Czaplicki <evan@Evans-MacBook-Air.local> dateThu 11 Jul 2013, 12:48 (13 years ago) parentabaa769
5 files changed+57−39
Elm.cabal+39−26 compiler/Docs.hs+5−6 compiler/Generate/JavaScript.hs−1 compiler/Initialize.hs+11−4 compiler/Type/State.hs+2−2
Elm.cabal+39−26
@@ -34,14 +34,16 @@ Library
3434 Language.Elm.Quasi
3535 Hs-Source-Dirs: compiler
3636 other-modules: Unique,
37+ SourceSyntax.Declaration,
38+ SourceSyntax.Expression,
39+ SourceSyntax.Everything,
3740 SourceSyntax.Helpers,
38− SourceSyntax.Location,
3941 SourceSyntax.Literal,
40− SourceSyntax.Pattern,
41− SourceSyntax.Expression,
42− SourceSyntax.Declaration,
42+ SourceSyntax.Location,
4343 SourceSyntax.Module,
44− SourceSyntax.Rename
44+ SourceSyntax.Pattern,
45+ SourceSyntax.Rename,
46+ SourceSyntax.Type,
4547 Generate.JavaScript,
4648 Generate.Noscript,
4749 Generate.Html,
@@ -52,21 +54,24 @@ Library
5254 Metadata.LoadLibraries,
5355 Initialize,
5456 Parse.Binop,
57+ Parse.Declaration,
5558 Parse.Expression,
56− Parse.Foreign,
5759 Parse.Helpers,
5860 Parse.Literal,
5961 Parse.Module,
6062 Parse.Parser,
6163 Parse.Pattern,
6264 Parse.Type,
63− Types.Alias,
64− Types.Types,
65− Types.Constrain,
66− Types.Hints,
67− Types.Solver,
68− Types.Substitutions,
69− Types.Unify,
65+ Type.Constrain.Declaration,
66+ Type.Constrain.Expression,
67+ Type.Constrain.Literal,
68+ Type.Constrain.Pattern,
69+ Type.Environment,
70+ Type.Fragment,
71+ Type.Solve,
72+ Type.State,
73+ Type.Type,
74+ Type.Unify,
7075 Paths_Elm
7176
7277 Build-depends: base >=4.2 && <5,
@@ -84,6 +89,7 @@ Library
8489 mtl >= 2,
8590 pandoc >= 1.10,
8691 parsec >= 3.1.1,
92+ pretty,
8793 shakespeare,
8894 text,
8995 template-haskell,
@@ -95,14 +101,16 @@ Executable elm
95101 Main-is: Compiler.hs
96102 Hs-Source-Dirs: compiler
97103 other-modules: Unique,
104+ SourceSyntax.Declaration,
105+ SourceSyntax.Expression,
106+ SourceSyntax.Everything,
98107 SourceSyntax.Helpers,
99− SourceSyntax.Location,
100108 SourceSyntax.Literal,
101− SourceSyntax.Pattern,
102− SourceSyntax.Expression,
103− SourceSyntax.Declaration,
109+ SourceSyntax.Location,
104110 SourceSyntax.Module,
105− SourceSyntax.Rename
111+ SourceSyntax.Pattern,
112+ SourceSyntax.Rename,
113+ SourceSyntax.Type,
106114 Generate.JavaScript,
107115 Generate.Noscript,
108116 Generate.Html,
@@ -113,21 +121,24 @@ Executable elm
113121 Metadata.LoadLibraries,
114122 Initialize,
115123 Parse.Binop,
124+ Parse.Declaration,
116125 Parse.Expression,
117− Parse.Foreign,
118126 Parse.Helpers,
119127 Parse.Literal,
120128 Parse.Module,
121129 Parse.Parser,
122130 Parse.Pattern,
123131 Parse.Type,
124− Types.Alias,
125− Types.Types,
126− Types.Constrain,
127− Types.Hints,
128− Types.Solver,
129− Types.Substitutions,
130− Types.Unify,
132+ Type.Constrain.Declaration,
133+ Type.Constrain.Expression,
134+ Type.Constrain.Literal,
135+ Type.Constrain.Pattern,
136+ Type.Environment,
137+ Type.Fragment,
138+ Type.Solve,
139+ Type.State,
140+ Type.Type,
141+ Type.Unify,
131142 Paths_Elm
132143
133144 Build-depends: base >=4.2 && <5,
@@ -145,6 +156,7 @@ Executable elm
145156 mtl >= 2,
146157 pandoc >= 1.10,
147158 parsec >= 3.1.1,
159+ pretty,
148160 transformers >= 0.2,
149161 union-find,
150162 uniplate
@@ -169,6 +181,7 @@ Executable elm-doc
169181 mtl >= 2,
170182 parsec >= 3.1.1,
171183 pandoc >= 1.10,
184+ pretty,
172185 cmdargs,
173186 filepath,
174187 indents
compiler/Docs.hs+5−6
@@ -4,16 +4,13 @@ module Main where
44import SourceSyntax.Declaration (Declaration(Datatype))
55import Control.Applicative ((<$>), (<*>))
66import Data.List (intercalate)
7−import Data.Maybe (catMaybes)
8−import Types.Types ((==>), Type ( ADT, VarT ) )
9−import Parse.Type (datatype)
7+import Parse.Type
108import Parse.Helpers
119import Parse.Module (moduleDef)
1210import Text.Parsec hiding (newline,spaces)
1311import System.Environment
1412import System.Exit
1513
16−
1714main = do
1815 srcs <- mapM readFile =<< getArgs
1916 case mapM docParse srcs of
@@ -64,11 +61,13 @@ annotation exports =
6461
6562 typeDef = lookAhead ((string "data" <|> string "type") >> whitespace >> capVar)
6663
67− adt = do
64+ adt = do undefined
65+{-- TODO: reimplement this
6866 (Datatype name tvs constructors) <- datatype
6967 let toType (cName, typeArgs) =
70− (cName, show $ foldr (==>) (ADT name $ map VarT tvs) typeArgs, "")
68+ (cName, show $ foldr (==>) (kADT name $ map kVarT tvs) typeArgs, "")
7169 return $ map toType constructors
70+--}
7271
7372setupParser p source =
7473 case iParse p "" source of
compiler/Generate/JavaScript.hs−1
@@ -14,7 +14,6 @@ import Generate.Cases
1414import SourceSyntax.Everything hiding (parens)
1515import SourceSyntax.Location as Loc
1616import Transform.SortDefinitions
17−import Types.Types ( Type(RecordT) )
1817
1918showErr :: String -> String
2019showErr err = globalAssign "Elm.Main" (jsFunc "elm" body)
compiler/Initialize.hs+11−4
@@ -9,14 +9,21 @@ import SourceSyntax.Everything
99import Data.List (intercalate,partition)
1010import Parse.Parser (parseProgram, parseDependencies)
1111import 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)
1612import Transform.Optimize
1713import System.Exit
1814import System.FilePath
1915
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+
2027checkMistakes :: (Data t, Data v) => Module t v -> Either String (Module t v)
2128checkMistakes modul@(Module name ex im stmts) =
2229 case mistakes stmts of
compiler/Type/State.hs+2−2
@@ -165,10 +165,10 @@ restore alreadyCopied variable = do
165165 debug $ putStr "Restoring: "
166166 desc <- liftIO $ UF.descriptor variable
167167 if mark desc /= alreadyCopied
168− then do
168+ then do
169169 debug $ putStrLn "not copied, no need to do anything"
170170 return variable
171− else do
171+ else do
172172 debug $ putStrLn "restoring"
173173 restoredStructure <-
174174 case structure desc of