on master help sign in
Get libraries to compile
727d708Evan Czaplicki
compiler/Type/Environment.hs+1−1
@@ -45,7 +45,7 @@ makeTypes datatypes =
45 builtins :: [(String,Int)]
45 builtins :: [(String,Int)]
46 builtins = concat [ map tuple [0..9]
46 builtins = concat [ map tuple [0..9]
47 , kind 1 ["_List","Maybe","Signal"]
47 , kind 1 ["_List","Maybe","Signal"]
48− , kind 0 ["Int","Float","Char","Bool","Element","Order"]
48+ , kind 0 ["Int","Float","Char","Bool","Element","Text","Color","Order"]
49 ]
49 ]
50
50
51
51
libraries/Color.elm+5
@@ -1,6 +1,8 @@
1
1
2module Color where
2module Color where
3
3
4+import Native.Color as Native
5+
4data Color = Color Int Int Int Float
6data Color = Color Int Int Int Float
5
7
6-- Create RGB colors with an alpha component for transparency.
8-- Create RGB colors with an alpha component for transparency.
@@ -56,16 +58,19 @@ forestGreen = Color 34 139 34 1
56-- Produce a “complementary color”.
58-- Produce a “complementary color”.
57-- The two colors will accent each other.
59-- The two colors will accent each other.
58complement : Color -> Color
60complement : Color -> Color
61+complement = Native.complement
59
62
60-- Create [HSV colors](http://en.wikipedia.org/wiki/HSL_and_HSV)
63-- Create [HSV colors](http://en.wikipedia.org/wiki/HSL_and_HSV)
61-- with an alpha component for transparency.
64-- with an alpha component for transparency.
62hsva : Float -> Float -> Float -> Float -> Color
65hsva : Float -> Float -> Float -> Float -> Color
66+hsva = Native.hsva
63
67
64-- Create [HSV colors](http://en.wikipedia.org/wiki/HSL_and_HSV).
68-- Create [HSV colors](http://en.wikipedia.org/wiki/HSL_and_HSV).
65-- This is very convenient for creating colors that cycle and shift.
69-- This is very convenient for creating colors that cycle and shift.
66--
70--
67-- hsv (degrees 240) 1 1 == blue
71-- hsv (degrees 240) 1 1 == blue
68hsv : Float -> Float -> Float -> Color
72hsv : Float -> Float -> Float -> Color
73+hsv = Native.hsv
69
74
70data Gradient
75data Gradient
71 = Linear (Float,Float) (Float,Float) [(Float,Color)]
76 = Linear (Float,Float) (Float,Float) [(Float,Color)]
libraries/Text.elm+20−2
@@ -1,61 +1,78 @@
1
1
2module Text where
2module Text where
3
3
4+import open Color
4−import Native.Text as T
5+import Native.Text as Native
5−
6
6
7-- Convert a string into text which can be styled and displayed.
7-- Convert a string into text which can be styled and displayed.
8toText : String -> Text
8toText : String -> Text
9+toText = Native.toText
9
10
10-- Set the typeface of some text. The first argument should be a comma separated listing of the desired typefaces
11-- Set the typeface of some text. The first argument should be a comma separated listing of the desired typefaces
11-- "helvetica, arial, sans-serif"
12-- "helvetica, arial, sans-serif"
12-- Works the same as the CSS font-family property.
13-- Works the same as the CSS font-family property.
13typeface : String -> Text -> Text
14typeface : String -> Text -> Text
15+typeface = Native.typeface
14
16
15-- Switch to a monospace typeface. Good for code snippets.
17-- Switch to a monospace typeface. Good for code snippets.
16monospace : Text -> Text
18monospace : Text -> Text
19+monospace = Native.monospace
17
20
18-- Make text big and noticable.
21-- Make text big and noticable.
19header : Text -> Text
22header : Text -> Text
23+header = Native.header
20
24
21-- Create a link.
25-- Create a link.
22link : String -> Text -> Text
26link : String -> Text -> Text
27+link = Native.link
23
28
24-- Set the height of text in pixels.
29-- Set the height of text in pixels.
25height : Float -> Text -> Text
30height : Float -> Text -> Text
31+height = Native.height
26
32
27-- Set the color of a string.
33-- Set the color of a string.
28color : Color -> Text -> Text
34color : Color -> Text -> Text
35+color = Native.color
29
36
30-- Make a string bold.
37-- Make a string bold.
31bold : Text -> Text
38bold : Text -> Text
39+bold = Native.bold
32
40
33-- Italicize a string.
41-- Italicize a string.
34italic : Text -> Text
42italic : Text -> Text
43+italic = Native.italic
35
44
36-- Draw a line above a string.
45-- Draw a line above a string.
37overline : Text -> Text
46overline : Text -> Text
47+overline = Native.overline
38
48
39-- Underline a string.
49-- Underline a string.
40underline : Text -> Text
50underline : Text -> Text
51+underline = Native.underline
41
52
42-- Draw a line through a string.
53-- Draw a line through a string.
43strikeThrough : Text -> Text
54strikeThrough : Text -> Text
55+strikeThrough = Native.strikeThrough
44
56
45-- Display justified, styled text.
57-- Display justified, styled text.
46justified : Text -> Element
58justified : Text -> Element
59+justified = Native.justified
47
60
48-- Display centered, styled text.
61-- Display centered, styled text.
49centered : Text -> Element
62centered : Text -> Element
63+centered = Native.centered
50
64
51-- Display right justified, styled text.
65-- Display right justified, styled text.
52righted : Text -> Element
66righted : Text -> Element
67+righted = Native.righted
53
68
54-- Display styled text.
69-- Display styled text.
55text : Text -> Element
70text : Text -> Element
71+text = Native.text
56
72
57-- Display a plain string.
73-- Display a plain string.
58plainText : String -> Element
74plainText : String -> Element
75+plainText = Native.plainText
59
76
60-- Convert anything to it's textual representation and make it displayable in browser
77-- Convert anything to it's textual representation and make it displayable in browser
61--
78--
@@ -63,3 +80,4 @@ plainText : String -> Element
63--
80--
64-- Excellent for debugging.
81-- Excellent for debugging.
65asText : a -> Element
82asText : a -> Element
83+asText = Native.asText