on master help sign in
Add type hints, update version.
commit9e82c6b19a523a7a6858e7527a30c28066f1627c authorevancz <info@elm-lang.org> dateTue 18 Sep 2012, 10:18 (14 years ago) parent5b957f2
6 files changed+31−12
elm/Elm.cabal+3−3 elm/elm-runtime-0.4.0.js → elm/elm-runtime-0.4.0.1.js elm/src/Compiler.hs+2−2 elm/src/Gen/CompileToJS.hs+1−1 elm/src/Types/Hints.hs+23−6 elm/src/Types/Types.hs+2
elm/Elm.cabal+3−3
@@ -1,6 +1,6 @@
11
22Name: Elm
3−Version: 0.4.0
3+Version: 0.4.0.1
44Synopsis: The Elm language module.
55Description: Elm aims to make client-side web-development more pleasant.
66 It is a statically/strongly typed, functional reactive
@@ -22,7 +22,7 @@ Category: Compiler, Language
2222Build-type: Simple
2323
2424Extra-source-files: changelog.txt
25−Data-files: elm-runtime-0.4.0.js
25+Data-files: elm-runtime-0.4.0.1.js
2626Cabal-version: >=1.8
2727
2828source-repository head
@@ -67,7 +67,7 @@ Library
6767 deepseq,
6868 text,
6969 template-haskell,
70− shakespeare,
70+ shakespeare >= 1,
7171 pandoc,
7272 bytestring,
7373 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."
4040 , minify = False &= help "Minify generated JavaScript"
4141 } &=
4242 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"
4444
4545main = do
4646 args <- cmdArgs elm
47− mini <- getDataFileName "elm-runtime-0.4.0.js"
47+ mini <- getDataFileName "elm-runtime-0.4.0.1.js"
4848 compileArgs mini args
4949
5050compileArgs mini (ELM _ [] _ _ _ _ _ _) =
elm/src/Gen/CompileToJS.hs+1−1
@@ -73,7 +73,7 @@ getExports names stmts = ret . braces $ intercalate "," pairs
7373
7474
7575jsImport (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 '"
7777 , drop 1 (dropWhile (/='.') modul)
7878 , "' is missing. Compile with --make flag or load missing "
7979 , "module in a separate JavaScript file.\";}" ] ++
elm/src/Types/Hints.hs+23−6
@@ -15,7 +15,8 @@ textToText = [ "header", "italic", "bold", "underline"
1515 , "overline", "strikeThrough", "monospace" ]
1616
1717textAttrs = [ "toText" -: string ==> text
18− --, "link" -: string ==> text ==> text
18+ , "typeface" -: string ==> text ==> text
19+ , "link" -:: string ==> a ==> a
1920 , numScheme (\t -> t ==> text ==> text) "Text.height"
2021 ] ++ hasType (text ==> text) textToText
2122
@@ -29,38 +30,53 @@ elements = let iee = int ==> element ==> element in
2930 , "width" -: iee
3031 , "height" -: iee
3132 , "size" -: int ==> iee
33+ , "widthOf" -: element ==> int
34+ , "heightOf"-: element ==> int
35+ , "sizeOf" -: element ==> pairOf int
3236 , "color" -: color ==> element ==> element
33− , "box" -: iee
34− , "rectangle" -: int ==> int ==> element
37+ , "container" -: int ==> int ==> position ==> element ==> element
38+ , "spacer" -: int ==> int ==> element
3539 , "rightedText" -: text ==> element
3640 , "centeredText" -: text ==> element
3741 , "justifiedText" -: text ==> element
3842 , "asText" -:: a ==> element
3943 , "show" -:: a ==> text
4044 , "collage" -: int ==> int ==> listOf form ==> element
45+ , "fittedImage" -: int ==> int ==> string ==> element
4146 ]
4247
4348directions = 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 ]
4455colors = [ numScheme (\n -> n ==> n ==> n ==> color) "rgb"
4556 , numScheme (\n -> n ==> n ==> n ==> n ==> color) "rgba"
4657 ] ++ hasType color ["red","green","blue","black","white"
4758 ,"yellow","cyan","magenta","grey","gray"]
4859
4960lineTypes = [ numScheme (\n -> listOf (pairOf n) ==> line) "line"
61+ , numScheme (\n -> pairOf n ==> pairOf n ==> line) "segment"
5062 , "customLine" -: listOf int ==> color ==> line ==> form
5163 ] ++ hasType (color ==> line ==> form) ["solid","dashed","dotted"]
5264
5365shapes = [ twoNums (\n m -> listOf (pairOf n) ==> pairOf m ==> shape) "polygon"
5466 , "filled" -: color ==> shape ==> form
5567 , "outlined" -: color ==> shape ==> form
68+ , "textured" -: string ==> shape ==> form
5669 , "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"
6070 ] ++ map (twoNums (\n m -> n ==> n ==> pairOf m ==> shape)) [ "ngon"
6171 , "rect"
6272 , "oval" ]
6373
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+ ]
6480
6581-------- Foreign --------
6682
@@ -256,4 +272,5 @@ hints = mapM (\(n,s) -> (,) n `liftM` rescheme s) hs
256272 where hs = concat [ funcs, lists, signals, math, bools, str2elem, textAttrs
257273 , elements, directions, colors, lineTypes, shapes
258274 , concreteSignals, casts, polyCasts, json, maybeFuncs
275+ , positions, collages
259276 ]
elm/src/Types/Types.hs+2
@@ -50,6 +50,8 @@ form = tipe "Form"
5050line = tipe "Line"
5151shape = tipe "Shape"
5252color = tipe "Color"
53+position = tipe "Position"
54+location = tipe "Location"
5355
5456listOf t = ADT "List" [t]
5557signalOf t = ADT "Signal" [t]