Add type hints, update version.
This commit is contained in:
parent
5b957f2e94
commit
9e82c6b19a
6 changed files with 31 additions and 12 deletions
|
@ -1,6 +1,6 @@
|
|||
|
||||
Name: Elm
|
||||
Version: 0.4.0
|
||||
Version: 0.4.0.1
|
||||
Synopsis: The Elm language module.
|
||||
Description: Elm aims to make client-side web-development more pleasant.
|
||||
It is a statically/strongly typed, functional reactive
|
||||
|
@ -22,7 +22,7 @@ Category: Compiler, Language
|
|||
Build-type: Simple
|
||||
|
||||
Extra-source-files: changelog.txt
|
||||
Data-files: elm-runtime-0.4.0.js
|
||||
Data-files: elm-runtime-0.4.0.1.js
|
||||
Cabal-version: >=1.8
|
||||
|
||||
source-repository head
|
||||
|
@ -67,7 +67,7 @@ Library
|
|||
deepseq,
|
||||
text,
|
||||
template-haskell,
|
||||
shakespeare,
|
||||
shakespeare >= 1,
|
||||
pandoc,
|
||||
bytestring,
|
||||
hjsmin
|
||||
|
|
|
@ -40,11 +40,11 @@ elm = ELM { make = False &= help "automatically compile dependencies."
|
|||
, minify = False &= help "Minify generated JavaScript"
|
||||
} &=
|
||||
help "Compile Elm programs to HTML, CSS, and JavaScript." &=
|
||||
summary "The Elm Compiler v0.4.0, (c) Evan Czaplicki"
|
||||
summary "The Elm Compiler v0.4.0.1, (c) Evan Czaplicki"
|
||||
|
||||
main = do
|
||||
args <- cmdArgs elm
|
||||
mini <- getDataFileName "elm-runtime-0.4.0.js"
|
||||
mini <- getDataFileName "elm-runtime-0.4.0.1.js"
|
||||
compileArgs mini args
|
||||
|
||||
compileArgs mini (ELM _ [] _ _ _ _ _ _) =
|
||||
|
|
|
@ -73,7 +73,7 @@ getExports names stmts = ret . braces $ intercalate "," pairs
|
|||
|
||||
|
||||
jsImport (modul, how) =
|
||||
concat [ "\ntry{" ++ modul ++ " instanceof Object} catch(e) {throw \"Module '"
|
||||
concat [ "\ntry{if (!(" ++ modul ++ " instanceof Object)) throw 'module not found'; } catch(e) {throw \"Module '"
|
||||
, drop 1 (dropWhile (/='.') modul)
|
||||
, "' is missing. Compile with --make flag or load missing "
|
||||
, "module in a separate JavaScript file.\";}" ] ++
|
||||
|
|
|
@ -15,7 +15,8 @@ textToText = [ "header", "italic", "bold", "underline"
|
|||
, "overline", "strikeThrough", "monospace" ]
|
||||
|
||||
textAttrs = [ "toText" -: string ==> text
|
||||
--, "link" -: string ==> text ==> text
|
||||
, "typeface" -: string ==> text ==> text
|
||||
, "link" -:: string ==> a ==> a
|
||||
, numScheme (\t -> t ==> text ==> text) "Text.height"
|
||||
] ++ hasType (text ==> text) textToText
|
||||
|
||||
|
@ -29,38 +30,53 @@ elements = let iee = int ==> element ==> element in
|
|||
, "width" -: iee
|
||||
, "height" -: iee
|
||||
, "size" -: int ==> iee
|
||||
, "widthOf" -: element ==> int
|
||||
, "heightOf"-: element ==> int
|
||||
, "sizeOf" -: element ==> pairOf int
|
||||
, "color" -: color ==> element ==> element
|
||||
, "box" -: iee
|
||||
, "rectangle" -: int ==> int ==> element
|
||||
, "container" -: int ==> int ==> position ==> element ==> element
|
||||
, "spacer" -: int ==> int ==> element
|
||||
, "rightedText" -: text ==> element
|
||||
, "centeredText" -: text ==> element
|
||||
, "justifiedText" -: text ==> element
|
||||
, "asText" -:: a ==> element
|
||||
, "show" -:: a ==> text
|
||||
, "collage" -: int ==> int ==> listOf form ==> element
|
||||
, "fittedImage" -: int ==> int ==> string ==> element
|
||||
]
|
||||
|
||||
directions = hasType direction ["up","down","left","right","inward","outward"]
|
||||
positions =
|
||||
hasType position ["topLeft","midLeft","bottomLeft","midTop","middle"
|
||||
,"midBottom","topRight","midRight","bottomRight"] ++
|
||||
hasType (location ==> position)
|
||||
["topLeftAt","bottomLeftAt","middleAt","topRightAt","bottomRightAt"] ++
|
||||
[ "absolute" -: int ==> location, "relative" -: float ==> location ]
|
||||
colors = [ numScheme (\n -> n ==> n ==> n ==> color) "rgb"
|
||||
, numScheme (\n -> n ==> n ==> n ==> n ==> color) "rgba"
|
||||
] ++ hasType color ["red","green","blue","black","white"
|
||||
,"yellow","cyan","magenta","grey","gray"]
|
||||
|
||||
lineTypes = [ numScheme (\n -> listOf (pairOf n) ==> line) "line"
|
||||
, numScheme (\n -> pairOf n ==> pairOf n ==> line) "segment"
|
||||
, "customLine" -: listOf int ==> color ==> line ==> form
|
||||
] ++ hasType (color ==> line ==> form) ["solid","dashed","dotted"]
|
||||
|
||||
shapes = [ twoNums (\n m -> listOf (pairOf n) ==> pairOf m ==> shape) "polygon"
|
||||
, "filled" -: color ==> shape ==> form
|
||||
, "outlined" -: color ==> shape ==> form
|
||||
, "textured" -: string ==> shape ==> form
|
||||
, "customOutline" -: listOf int ==> color ==> shape ==> form
|
||||
, numScheme (\n -> n ==> n ==> form ==> form) "move"
|
||||
, numScheme (\n -> n ==> form ==> form) "rotate"
|
||||
, numScheme (\n -> n ==> form ==> form) "scale"
|
||||
] ++ map (twoNums (\n m -> n ==> n ==> pairOf m ==> shape)) [ "ngon"
|
||||
, "rect"
|
||||
, "oval" ]
|
||||
|
||||
collages = [ numScheme (\n -> pairOf n ==> element ==> form) "toForm"
|
||||
, numScheme (\n -> string ==> n ==> n ==> pairOf n ==> form) "sprite"
|
||||
, numScheme (\n -> n ==> n ==> form ==> form) "move"
|
||||
, numScheme (\n -> n ==> form ==> form) "rotate"
|
||||
, numScheme (\n -> n ==> form ==> form) "scale"
|
||||
]
|
||||
|
||||
-------- Foreign --------
|
||||
|
||||
|
@ -256,4 +272,5 @@ hints = mapM (\(n,s) -> (,) n `liftM` rescheme s) hs
|
|||
where hs = concat [ funcs, lists, signals, math, bools, str2elem, textAttrs
|
||||
, elements, directions, colors, lineTypes, shapes
|
||||
, concreteSignals, casts, polyCasts, json, maybeFuncs
|
||||
, positions, collages
|
||||
]
|
||||
|
|
|
@ -50,6 +50,8 @@ form = tipe "Form"
|
|||
line = tipe "Line"
|
||||
shape = tipe "Shape"
|
||||
color = tipe "Color"
|
||||
position = tipe "Position"
|
||||
location = tipe "Location"
|
||||
|
||||
listOf t = ADT "List" [t]
|
||||
signalOf t = ADT "Signal" [t]
|
||||
|
|
Loading…
Reference in a new issue