on master help sign in
Fix bugs with --make flag. Update new to version number. Make sure that all built-in modules are recognized by the compiler.
eb748aeevancz
elm/Elm.cabal+2−2
@@ -1,6 +1,6 @@
1
1
2Name: Elm
2Name: Elm
3−Version: 0.4.0.1
3+Version: 0.4.0.2
4Synopsis: The Elm language module.
4Synopsis: The Elm language module.
5Description: Elm aims to make client-side web-development more pleasant.
5Description: Elm aims to make client-side web-development more pleasant.
6 It is a statically/strongly typed, functional reactive
6 It is a statically/strongly typed, functional reactive
@@ -22,7 +22,7 @@ Category: Compiler, Language
22Build-type: Simple
22Build-type: Simple
23
23
24Extra-source-files: changelog.txt
24Extra-source-files: changelog.txt
25−Data-files: elm-runtime-0.4.0.1.js
25+Data-files: elm-runtime-0.4.0.2.js
26Cabal-version: >=1.8
26Cabal-version: >=1.8
27
27
28source-repository head
28source-repository head
elm/elm-runtime-0.4.0.1.js → elm/elm-runtime-0.4.0.2.jsrenamed

The content is the same.

elm/src/Ast.hs+1
@@ -101,6 +101,7 @@ instance Show Expr where
101 show (Fold e1 e2 e3) = concat [ "foldp ", show' e1, " ", show' e2, " ", show' e3 ]
101 show (Fold e1 e2 e3) = concat [ "foldp ", show' e1, " ", show' e2, " ", show' e3 ]
102 show (Async e) = "async " ++ show' e
102 show (Async e) = "async " ++ show' e
103 show (Input i) = i
103 show (Input i) = i
104+ show (Markdown _) = "[markdown| ... |]"
104
105
105
106
106instance Show Definition where
107instance Show Definition where
elm/src/Compiler.hs+7−6
@@ -40,11 +40,11 @@ elm = ELM { make = False &= help "automatically compile dependencies."
40 , minify = False &= help "Minify generated JavaScript"
40 , minify = False &= help "Minify generated JavaScript"
41 } &=
41 } &=
42 help "Compile Elm programs to HTML, CSS, and JavaScript." &=
42 help "Compile Elm programs to HTML, CSS, and JavaScript." &=
43− summary "The Elm Compiler v0.4.0.1, (c) Evan Czaplicki"
43+ summary "The Elm Compiler v0.4.0.2, (c) Evan Czaplicki"
44
44
45main = do
45main = do
46 args <- cmdArgs elm
46 args <- cmdArgs elm
47− mini <- getDataFileName "elm-runtime-0.4.0.1.js"
47+ mini <- getDataFileName "elm-runtime-0.4.0.2.js"
48 compileArgs mini args
48 compileArgs mini args
49
49
50compileArgs mini (ELM _ [] _ _ _ _ _ _) =
50compileArgs mini (ELM _ [] _ _ _ _ _ _) =
@@ -100,9 +100,10 @@ toFilePath :: String -> FilePath
100toFilePath modul = map (\c -> if c == '.' then '/' else c) modul ++ ".elm"
100toFilePath modul = map (\c -> if c == '.' then '/' else c) modul ++ ".elm"
101
101
102builtInModules =
102builtInModules =
103− concat [ map ("Data."++) [ "List", "Char", "Maybe" ]
103+ concat [ map ("Data."++) [ "List", "Char", "Maybe" ]
104− , map ("Signal."++) [ "Mouse", "Keyboard.Raw"
104+ , map ("Signal."++) [ "Mouse", "Keyboard.Raw"
105− , "Window", "Time", "HTTP", "Input", "Random" ]
105+ , "Window", "Time", "HTTP", "Input", "Random" ]
106− , [ "Element", "Text", "Color", "Line" ]
106+ , map ("Graphics."++) [ "Element", "Text", "Color" ]
107+ , map ("Foreign.JavaScript"++) [ "", "JSON", "Experimental" ]
107 , [ "Prelude" ]
108 , [ "Prelude" ]
108 ]
109 ]
elm/src/Gen/CompileToJS.hs+3−2
@@ -59,12 +59,13 @@ jsModule (escapees, Module names exports imports stmts) =
59 modName = intercalate "." modNames
59 modName = intercalate "." modNames
60 includes = concatMap jsImport $ map (first ("ElmCode."++)) imports
60 includes = concatMap jsImport $ map (first ("ElmCode."++)) imports
61 body = stmtsToJS stmts
61 body = stmtsToJS stmts
62− export = getExports exps stmts
62+ export = getExports exports stmts
63 exps = if null exports then ["main"] else exports
63 exps = if null exports then ["main"] else exports
64
64
65getExports names stmts = ret . braces $ intercalate "," pairs
65getExports names stmts = ret . braces $ intercalate "," pairs
66 where pairs = mapMaybe pair $ concatMap get stmts
66 where pairs = mapMaybe pair $ concatMap get stmts
67− pair x = if y `elem` names then Just $ y ++ ":" ++ x else Nothing
67+ pair x = if null names || y `elem` names then
68+ Just $ y ++ ":" ++ x else Nothing
68 where y = derename x
69 where y = derename x
69 get s = case s of Def x _ _ -> [x]
70 get s = case s of Def x _ _ -> [x]
70 Datatype _ _ tcs -> map fst tcs
71 Datatype _ _ tcs -> map fst tcs
elm/src/Rename.hs+4−2
@@ -14,7 +14,7 @@ derename var
14
14
15rename :: Module -> Module
15rename :: Module -> Module
16rename (Module name ex im stmts) =
16rename (Module name ex im stmts) =
17− Module name ex im . run $ renameStatements id stmts
17+ Module name ex im . run $ renameStatements deprime stmts
18
18
19renameStatements env stmts = do env' <- extends env $ concatMap getNames stmts
19renameStatements env stmts = do env' <- extends env $ concatMap getNames stmts
20 mapM (renameStmt env') stmts
20 mapM (renameStmt env') stmts
@@ -83,10 +83,12 @@ rename' env expr =
83
83
84 where rnm = rename' env
84 where rnm = rename' env
85
85
86+deprime = map (\c -> if c == '\'' then '_' else c)
87+
86extend :: (String -> String) -> String -> GuidCounter (String, String -> String)
88extend :: (String -> String) -> String -> GuidCounter (String, String -> String)
87extend env x = do
89extend env x = do
88 n <- guid
90 n <- guid
89− let rx = map (\c -> if c == '\'' then '_' else c) $ x ++ "_" ++ show n
91+ let rx = deprime x ++ "_" ++ show n
90 return (rx, \y -> if y == x then rx else env y)
92 return (rx, \y -> if y == x then rx else env y)
91
93
92extends :: (String -> String) -> [String] -> GuidCounter (String -> String)
94extends :: (String -> String) -> [String] -> GuidCounter (String -> String)