on master help sign in
Get more libraries compiling
commit20067c466fba1735207bb9dd5d467918b0544923 authorEvan Czaplicki <info@elm-lang.org> dateFri 26 Jul 2013, 19:05 (13 years ago) parent602117f
5 files changed+25−18
libraries/Date.elm+2−1 libraries/Http.elm+2−1 libraries/Set.elm+15−14 libraries/Touch.elm+4−1 libraries/WebSocket.elm+2−1
libraries/Date.elm+2−1
@@ -5,7 +5,8 @@
55module Date where
66
77import Native.Date as Native
8−import Time
8+import Time (Time)
9+import Maybe (Maybe)
910
1011data Date = Date
1112
libraries/Http.elm+2−1
@@ -4,7 +4,7 @@
44
55module Http where
66
7−import Native.Http (send)
7+import Native.Http as Native
88import Signal (lift)
99
1010-- The datatype for responses. Success contains only the returned message.
@@ -35,6 +35,7 @@ post url body = Request "POST" url body []
3535-- Performs an HTTP request with the given requests. Produces a signal
3636-- that carries the responses.
3737send : Signal (Request a) -> Signal (Response String)
38+send = Native.send
3839
3940-- Performs an HTTP GET request with the given urls. Produces a signal
4041-- that carries the responses.
libraries/Set.elm+15−14
@@ -6,60 +6,61 @@ module Set (empty,singleton,insert,remove
66 ,toList,fromList
77 ) where
88
9+import Maybe (Maybe)
910import Dict as Dict
1011import List as List
1112
12−type Set t = Dict t ()
13+type Set t = Dict.Dict t ()
1314
1415-- Create an empty set.
15−empty : Set (Comparable k)
16+empty : Set comparable
1617empty = Dict.empty
1718
1819-- Create a set with one value.
19−singleton : Comparable k -> Set (Comparable k)
20+singleton : comparable -> Set comparable
2021singleton k = Dict.singleton k ()
2122
2223-- Insert a value into a set.
23−insert : Comparable k -> Set (Comparable k) -> Set (Comparable k)
24+insert : comparable -> Set comparable -> Set comparable
2425insert k = Dict.insert k ()
2526
2627-- Remove a value from a set. If the value is not found, no changes are made.
27−remove : Comparable k -> Set (Comparable k) -> Set (Comparable k)
28+remove : comparable -> Set comparable -> Set comparable
2829remove = Dict.remove
2930
3031-- Determine if a value is in a set.
31−member : Comparable k -> Set (Comparable k) -> Bool
32+member : comparable -> Set comparable -> Bool
3233member = Dict.member
3334
3435-- Get the union of two sets. Keep all values.
35−union : Set (Comparable k) -> Set (Comparable k) -> Set (Comparable k)
36+union : Set comparable -> Set comparable -> Set comparable
3637union = Dict.union
3738
3839-- Get the intersection of two sets. Keeps values that appear in both sets.
39−intersect : Set (Comparable k) -> Set (Comparable k) -> Set (Comparable k)
40+intersect : Set comparable -> Set comparable -> Set comparable
4041intersect = Dict.intersect
4142
4243-- Get the difference between the first set and the second. Keeps values
4344-- that do not appear in the second set.
44−diff : Set (Comparable k) -> Set (Comparable k) -> Set (Comparable k)
45+diff : Set comparable -> Set comparable -> Set comparable
4546diff = Dict.diff
4647
4748-- Convert a set into a list.
48−toList : Set (Comparable k) -> [Comparable k]
49+toList : Set comparable -> [comparable]
4950toList = Dict.keys
5051
5152-- Convert a list into a set, removing any duplicates.
52−fromList : [Comparable k] -> Set (Comparable k)
53+fromList : [comparable] -> Set comparable
5354fromList xs = List.foldl insert empty xs
5455
5556-- Fold over the values in a set, in order from lowest to highest.
56−foldl : (Comparable a -> b -> b) -> b -> Set (Comparable a) -> b
57+foldl : (comparable -> b -> b) -> b -> Set comparable -> b
5758foldl f b s = Dict.foldl (\k _ b -> f k b) b s
5859
5960-- Fold over the values in a set, in order from highest to lowest.
60−foldr : (Comparable a -> b -> b) -> b -> Set (Comparable a) -> b
61+foldr : (comparable -> b -> b) -> b -> Set comparable -> b
6162foldr f b s = Dict.foldr (\k _ b -> f k b) b s
6263
6364-- Map a function onto a set, creating a new set with no duplicates.
64−map : (Comparable a -> Comparable b) -> Set (Comparable a) -> Set (Comparable b)
65+map : (comparable -> comparable') -> Set comparable -> Set comparable'
6566map f s = fromList (List.map f (toList s))
libraries/Touch.elm+4−1
@@ -2,7 +2,8 @@
22-- include gestures that would be useful for both games and web-pages.
33module Touch where
44
5−import Native.Touch as T
5+import Native.Touch as Native
6+import Time (Time)
67
78-- Every `Touch` has `xy` coordinates. It also has an identifier `id` to
89-- distinguish one touch from another.
@@ -14,7 +15,9 @@ type Touch = { x:Int, y:Int, id:Int, x0:Int, y0:Int, t0:Time }
1415
1516-- A list of ongoing touches.
1617touches : Signal [Touch]
18+touches = Native.touches
1719
1820-- The last position that was tapped. Default value is `{x=0,y=0}`.
1921-- Updates whenever the user taps the screen.
2022taps : Signal { x:Int, y:Int }
23+taps = Native.taps
libraries/WebSocket.elm+2−1
@@ -2,12 +2,13 @@
22-- standard requests like GET, POST, etc.
33module WebSocket where
44
5−import Native.WebSocket as WS
5+import Native.WebSocket as Native
66
77-- Create a web-socket. The first argument is the URL of the desired
88-- web-socket server. The input signal holds the outgoing messages,
99-- and the resulting signal contains the incoming ones.
1010connect : String -> Signal String -> Signal String
11+connect = Native.connect
1112
1213-- data Action = Open String | Close String | Send String String
1314-- connections : Signal Action -> Signal String