on master help sign in
Get libraries to compile
commit727d708289f86f5e8ffbcdd1d4cc7fdf50949118 authorEvan Czaplicki <info@elm-lang.org> dateFri 26 Jul 2013, 00:19 (13 years ago) parent1753583
3 files changed+26−3
compiler/Type/Environment.hs+1−1 libraries/Color.elm+5 libraries/Text.elm+20−2
compiler/Type/Environment.hs+1−1
@@ -45,7 +45,7 @@ makeTypes datatypes =
4545 builtins :: [(String,Int)]
4646 builtins = concat [ map tuple [0..9]
4747 , 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"]
4949 ]
5050
5151
libraries/Color.elm+5
@@ -1,6 +1,8 @@
11
22module Color where
33
4+import Native.Color as Native
5+
46data Color = Color Int Int Int Float
57
68-- Create RGB colors with an alpha component for transparency.
@@ -56,16 +58,19 @@ forestGreen = Color 34 139 34 1
5658-- Produce a &ldquo;complementary color&rdquo;.
5759-- The two colors will accent each other.
5860complement : Color -> Color
61+complement = Native.complement
5962
6063-- Create [HSV colors](http://en.wikipedia.org/wiki/HSL_and_HSV)
6164-- with an alpha component for transparency.
6265hsva : Float -> Float -> Float -> Float -> Color
66+hsva = Native.hsva
6367
6468-- Create [HSV colors](http://en.wikipedia.org/wiki/HSL_and_HSV).
6569-- This is very convenient for creating colors that cycle and shift.
6670--
6771-- hsv (degrees 240) 1 1 == blue
6872hsv : Float -> Float -> Float -> Color
73+hsv = Native.hsv
6974
7075data Gradient
7176 = Linear (Float,Float) (Float,Float) [(Float,Color)]
libraries/Text.elm+20−2
@@ -1,61 +1,78 @@
11
22module Text where
33
4−import Native.Text as T
5−
4+import open Color
5+import Native.Text as Native
66
77-- Convert a string into text which can be styled and displayed.
88toText : String -> Text
9+toText = Native.toText
910
1011-- Set the typeface of some text. The first argument should be a comma separated listing of the desired typefaces
1112-- "helvetica, arial, sans-serif"
1213-- Works the same as the CSS font-family property.
1314typeface : String -> Text -> Text
15+typeface = Native.typeface
1416
1517-- Switch to a monospace typeface. Good for code snippets.
1618monospace : Text -> Text
19+monospace = Native.monospace
1720
1821-- Make text big and noticable.
1922header : Text -> Text
23+header = Native.header
2024
2125-- Create a link.
2226link : String -> Text -> Text
27+link = Native.link
2328
2429-- Set the height of text in pixels.
2530height : Float -> Text -> Text
31+height = Native.height
2632
2733-- Set the color of a string.
2834color : Color -> Text -> Text
35+color = Native.color
2936
3037-- Make a string bold.
3138bold : Text -> Text
39+bold = Native.bold
3240
3341-- Italicize a string.
3442italic : Text -> Text
43+italic = Native.italic
3544
3645-- Draw a line above a string.
3746overline : Text -> Text
47+overline = Native.overline
3848
3949-- Underline a string.
4050underline : Text -> Text
51+underline = Native.underline
4152
4253-- Draw a line through a string.
4354strikeThrough : Text -> Text
55+strikeThrough = Native.strikeThrough
4456
4557-- Display justified, styled text.
4658justified : Text -> Element
59+justified = Native.justified
4760
4861-- Display centered, styled text.
4962centered : Text -> Element
63+centered = Native.centered
5064
5165-- Display right justified, styled text.
5266righted : Text -> Element
67+righted = Native.righted
5368
5469-- Display styled text.
5570text : Text -> Element
71+text = Native.text
5672
5773-- Display a plain string.
5874plainText : String -> Element
75+plainText = Native.plainText
5976
6077-- Convert anything to it's textual representation and make it displayable in browser
6178--
@@ -63,3 +80,4 @@ plainText : String -> Element
6380--
6481-- Excellent for debugging.
6582asText : a -> Element
83+asText = Native.asText