on master help sign in
Add type hints, update version.
9e82c6bevancz
elm/Elm.cabal+3−3
@@ -1,6 +1,6 @@
1
1
2Name: Elm
2Name: Elm
3−Version: 0.4.0
3+Version: 0.4.0.1
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.js
25+Data-files: elm-runtime-0.4.0.1.js
26Cabal-version: >=1.8
26Cabal-version: >=1.8
27
27
28source-repository head
28source-repository head
@@ -67,7 +67,7 @@ Library
67 deepseq,
67 deepseq,
68 text,
68 text,
69 template-haskell,
69 template-haskell,
70− shakespeare,
70+ shakespeare >= 1,
71 pandoc,
71 pandoc,
72 bytestring,
72 bytestring,
73 hjsmin
73 hjsmin
elm/elm-runtime-0.4.0.js → elm/elm-runtime-0.4.0.1.jsrenamed

The content is the same.

elm/src/Compiler.hs+2−2
@@ -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, (c) Evan Czaplicki"
43+ summary "The Elm Compiler v0.4.0.1, (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.js"
47+ mini <- getDataFileName "elm-runtime-0.4.0.1.js"
48 compileArgs mini args
48 compileArgs mini args
49
49
50compileArgs mini (ELM _ [] _ _ _ _ _ _) =
50compileArgs mini (ELM _ [] _ _ _ _ _ _) =
elm/src/Gen/CompileToJS.hs+1−1
@@ -73,7 +73,7 @@ getExports names stmts = ret . braces $ intercalate "," pairs
73
73
74
74
75jsImport (modul, how) =
75jsImport (modul, how) =
76− concat [ "\ntry{" ++ modul ++ " instanceof Object} catch(e) {throw \"Module '"
76+ concat [ "\ntry{if (!(" ++ modul ++ " instanceof Object)) throw 'module not found'; } catch(e) {throw \"Module '"
77 , drop 1 (dropWhile (/='.') modul)
77 , drop 1 (dropWhile (/='.') modul)
78 , "' is missing. Compile with --make flag or load missing "
78 , "' is missing. Compile with --make flag or load missing "
79 , "module in a separate JavaScript file.\";}" ] ++
79 , "module in a separate JavaScript file.\";}" ] ++
elm/src/Types/Hints.hs+23−6
@@ -15,7 +15,8 @@ textToText = [ "header", "italic", "bold", "underline"
15 , "overline", "strikeThrough", "monospace" ]
15 , "overline", "strikeThrough", "monospace" ]
16
16
17textAttrs = [ "toText" -: string ==> text
17textAttrs = [ "toText" -: string ==> text
18+ , "typeface" -: string ==> text ==> text
18− --, "link" -: string ==> text ==> text
19+ , "link" -:: string ==> a ==> a
19 , numScheme (\t -> t ==> text ==> text) "Text.height"
20 , numScheme (\t -> t ==> text ==> text) "Text.height"
20 ] ++ hasType (text ==> text) textToText
21 ] ++ hasType (text ==> text) textToText
21
22
@@ -29,38 +30,53 @@ elements = let iee = int ==> element ==> element in
29 , "width" -: iee
30 , "width" -: iee
30 , "height" -: iee
31 , "height" -: iee
31 , "size" -: int ==> iee
32 , "size" -: int ==> iee
33+ , "widthOf" -: element ==> int
34+ , "heightOf"-: element ==> int
35+ , "sizeOf" -: element ==> pairOf int
32 , "color" -: color ==> element ==> element
36 , "color" -: color ==> element ==> element
33− , "box" -: iee
37+ , "container" -: int ==> int ==> position ==> element ==> element
34− , "rectangle" -: int ==> int ==> element
38+ , "spacer" -: int ==> int ==> element
35 , "rightedText" -: text ==> element
39 , "rightedText" -: text ==> element
36 , "centeredText" -: text ==> element
40 , "centeredText" -: text ==> element
37 , "justifiedText" -: text ==> element
41 , "justifiedText" -: text ==> element
38 , "asText" -:: a ==> element
42 , "asText" -:: a ==> element
39 , "show" -:: a ==> text
43 , "show" -:: a ==> text
40 , "collage" -: int ==> int ==> listOf form ==> element
44 , "collage" -: int ==> int ==> listOf form ==> element
45+ , "fittedImage" -: int ==> int ==> string ==> element
41 ]
46 ]
42
47
43directions = hasType direction ["up","down","left","right","inward","outward"]
48directions = hasType direction ["up","down","left","right","inward","outward"]
49+positions =
50+ hasType position ["topLeft","midLeft","bottomLeft","midTop","middle"
51+ ,"midBottom","topRight","midRight","bottomRight"] ++
52+ hasType (location ==> position)
53+ ["topLeftAt","bottomLeftAt","middleAt","topRightAt","bottomRightAt"] ++
54+ [ "absolute" -: int ==> location, "relative" -: float ==> location ]
44colors = [ numScheme (\n -> n ==> n ==> n ==> color) "rgb"
55colors = [ numScheme (\n -> n ==> n ==> n ==> color) "rgb"
45 , numScheme (\n -> n ==> n ==> n ==> n ==> color) "rgba"
56 , numScheme (\n -> n ==> n ==> n ==> n ==> color) "rgba"
46 ] ++ hasType color ["red","green","blue","black","white"
57 ] ++ hasType color ["red","green","blue","black","white"
47 ,"yellow","cyan","magenta","grey","gray"]
58 ,"yellow","cyan","magenta","grey","gray"]
48
59
49lineTypes = [ numScheme (\n -> listOf (pairOf n) ==> line) "line"
60lineTypes = [ numScheme (\n -> listOf (pairOf n) ==> line) "line"
61+ , numScheme (\n -> pairOf n ==> pairOf n ==> line) "segment"
50 , "customLine" -: listOf int ==> color ==> line ==> form
62 , "customLine" -: listOf int ==> color ==> line ==> form
51 ] ++ hasType (color ==> line ==> form) ["solid","dashed","dotted"]
63 ] ++ hasType (color ==> line ==> form) ["solid","dashed","dotted"]
52
64
53shapes = [ twoNums (\n m -> listOf (pairOf n) ==> pairOf m ==> shape) "polygon"
65shapes = [ twoNums (\n m -> listOf (pairOf n) ==> pairOf m ==> shape) "polygon"
54 , "filled" -: color ==> shape ==> form
66 , "filled" -: color ==> shape ==> form
55 , "outlined" -: color ==> shape ==> form
67 , "outlined" -: color ==> shape ==> form
68+ , "textured" -: string ==> shape ==> form
56 , "customOutline" -: listOf int ==> color ==> shape ==> form
69 , "customOutline" -: listOf int ==> color ==> shape ==> form
57− , numScheme (\n -> n ==> n ==> form ==> form) "move"
58− , numScheme (\n -> n ==> form ==> form) "rotate"
59− , numScheme (\n -> n ==> form ==> form) "scale"
60 ] ++ map (twoNums (\n m -> n ==> n ==> pairOf m ==> shape)) [ "ngon"
70 ] ++ map (twoNums (\n m -> n ==> n ==> pairOf m ==> shape)) [ "ngon"
61 , "rect"
71 , "rect"
62 , "oval" ]
72 , "oval" ]
63
73
74+collages = [ numScheme (\n -> pairOf n ==> element ==> form) "toForm"
75+ , numScheme (\n -> string ==> n ==> n ==> pairOf n ==> form) "sprite"
76+ , numScheme (\n -> n ==> n ==> form ==> form) "move"
77+ , numScheme (\n -> n ==> form ==> form) "rotate"
78+ , numScheme (\n -> n ==> form ==> form) "scale"
79+ ]
64
80
65-------- Foreign --------
81-------- Foreign --------
66
82
@@ -256,4 +272,5 @@ hints = mapM (\(n,s) -> (,) n `liftM` rescheme s) hs
256 where hs = concat [ funcs, lists, signals, math, bools, str2elem, textAttrs
272 where hs = concat [ funcs, lists, signals, math, bools, str2elem, textAttrs
257 , elements, directions, colors, lineTypes, shapes
273 , elements, directions, colors, lineTypes, shapes
258 , concreteSignals, casts, polyCasts, json, maybeFuncs
274 , concreteSignals, casts, polyCasts, json, maybeFuncs
275+ , positions, collages
259 ]
276 ]
elm/src/Types/Types.hs+2
@@ -50,6 +50,8 @@ form = tipe "Form"
50line = tipe "Line"
50line = tipe "Line"
51shape = tipe "Shape"
51shape = tipe "Shape"
52color = tipe "Color"
52color = tipe "Color"
53+position = tipe "Position"
54+location = tipe "Location"
53
55
54listOf t = ADT "List" [t]
56listOf t = ADT "List" [t]
55signalOf t = ADT "Signal" [t]
57signalOf t = ADT "Signal" [t]