on master help sign in
Get more libraries compiling
20067c4Evan Czaplicki
libraries/Date.elm+2−1
@@ -5,7 +5,8 @@
5module Date where
5module Date where
6
6
7import Native.Date as Native
7import Native.Date as Native
8−import Time
8+import Time (Time)
9+import Maybe (Maybe)
9
10
10data Date = Date
11data Date = Date
11
12
libraries/Http.elm+2−1
@@ -4,7 +4,7 @@
4
4
5module Http where
5module Http where
6
6
7−import Native.Http (send)
7+import Native.Http as Native
8import Signal (lift)
8import Signal (lift)
9
9
10-- The datatype for responses. Success contains only the returned message.
10-- The datatype for responses. Success contains only the returned message.
@@ -35,6 +35,7 @@ post url body = Request "POST" url body []
35-- Performs an HTTP request with the given requests. Produces a signal
35-- Performs an HTTP request with the given requests. Produces a signal
36-- that carries the responses.
36-- that carries the responses.
37send : Signal (Request a) -> Signal (Response String)
37send : Signal (Request a) -> Signal (Response String)
38+send = Native.send
38
39
39-- Performs an HTTP GET request with the given urls. Produces a signal
40-- Performs an HTTP GET request with the given urls. Produces a signal
40-- that carries the responses.
41-- that carries the responses.
libraries/Set.elm+15−14
@@ -6,60 +6,61 @@ module Set (empty,singleton,insert,remove
6 ,toList,fromList
6 ,toList,fromList
7 ) where
7 ) where
8
8
9+import Maybe (Maybe)
9import Dict as Dict
10import Dict as Dict
10import List as List
11import List as List
11
12
12−type Set t = Dict t ()
13+type Set t = Dict.Dict t ()
13
14
14-- Create an empty set.
15-- Create an empty set.
15−empty : Set (Comparable k)
16+empty : Set comparable
16empty = Dict.empty
17empty = Dict.empty
17
18
18-- Create a set with one value.
19-- Create a set with one value.
19−singleton : Comparable k -> Set (Comparable k)
20+singleton : comparable -> Set comparable
20singleton k = Dict.singleton k ()
21singleton k = Dict.singleton k ()
21
22
22-- Insert a value into a set.
23-- Insert a value into a set.
23−insert : Comparable k -> Set (Comparable k) -> Set (Comparable k)
24+insert : comparable -> Set comparable -> Set comparable
24insert k = Dict.insert k ()
25insert k = Dict.insert k ()
25
26
26-- Remove a value from a set. If the value is not found, no changes are made.
27-- 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
28remove = Dict.remove
29remove = Dict.remove
29
30
30-- Determine if a value is in a set.
31-- Determine if a value is in a set.
31−member : Comparable k -> Set (Comparable k) -> Bool
32+member : comparable -> Set comparable -> Bool
32member = Dict.member
33member = Dict.member
33
34
34-- Get the union of two sets. Keep all values.
35-- 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
36union = Dict.union
37union = Dict.union
37
38
38-- Get the intersection of two sets. Keeps values that appear in both sets.
39-- 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
40intersect = Dict.intersect
41intersect = Dict.intersect
41
42
42-- Get the difference between the first set and the second. Keeps values
43-- Get the difference between the first set and the second. Keeps values
43-- that do not appear in the second set.
44-- 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
45diff = Dict.diff
46diff = Dict.diff
46
47
47-- Convert a set into a list.
48-- Convert a set into a list.
48−toList : Set (Comparable k) -> [Comparable k]
49+toList : Set comparable -> [comparable]
49toList = Dict.keys
50toList = Dict.keys
50
51
51-- Convert a list into a set, removing any duplicates.
52-- Convert a list into a set, removing any duplicates.
52−fromList : [Comparable k] -> Set (Comparable k)
53+fromList : [comparable] -> Set comparable
53fromList xs = List.foldl insert empty xs
54fromList xs = List.foldl insert empty xs
54
55
55-- Fold over the values in a set, in order from lowest to highest.
56-- 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
57foldl f b s = Dict.foldl (\k _ b -> f k b) b s
58foldl f b s = Dict.foldl (\k _ b -> f k b) b s
58
59
59-- Fold over the values in a set, in order from highest to lowest.
60-- 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
61foldr f b s = Dict.foldr (\k _ b -> f k b) b s
62foldr f b s = Dict.foldr (\k _ b -> f k b) b s
62
63
63-- Map a function onto a set, creating a new set with no duplicates.
64-- 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'
65map f s = fromList (List.map f (toList s))
66map f s = fromList (List.map f (toList s))
libraries/Touch.elm+4−1
@@ -2,7 +2,8 @@
2-- include gestures that would be useful for both games and web-pages.
2-- include gestures that would be useful for both games and web-pages.
3module Touch where
3module Touch where
4
4
5−import Native.Touch as T
5+import Native.Touch as Native
6+import Time (Time)
6
7
7-- Every `Touch` has `xy` coordinates. It also has an identifier `id` to
8-- Every `Touch` has `xy` coordinates. It also has an identifier `id` to
8-- distinguish one touch from another.
9-- distinguish one touch from another.
@@ -14,7 +15,9 @@ type Touch = { x:Int, y:Int, id:Int, x0:Int, y0:Int, t0:Time }
14
15
15-- A list of ongoing touches.
16-- A list of ongoing touches.
16touches : Signal [Touch]
17touches : Signal [Touch]
18+touches = Native.touches
17
19
18-- The last position that was tapped. Default value is `{x=0,y=0}`.
20-- The last position that was tapped. Default value is `{x=0,y=0}`.
19-- Updates whenever the user taps the screen.
21-- Updates whenever the user taps the screen.
20taps : Signal { x:Int, y:Int }
22taps : Signal { x:Int, y:Int }
23+taps = Native.taps
libraries/WebSocket.elm+2−1
@@ -2,12 +2,13 @@
2-- standard requests like GET, POST, etc.
2-- standard requests like GET, POST, etc.
3module WebSocket where
3module WebSocket where
4
4
5−import Native.WebSocket as WS
5+import Native.WebSocket as Native
6
6
7-- Create a web-socket. The first argument is the URL of the desired
7-- Create a web-socket. The first argument is the URL of the desired
8-- web-socket server. The input signal holds the outgoing messages,
8-- web-socket server. The input signal holds the outgoing messages,
9-- and the resulting signal contains the incoming ones.
9-- and the resulting signal contains the incoming ones.
10connect : String -> Signal String -> Signal String
10connect : String -> Signal String -> Signal String
11+connect = Native.connect
11
12
12-- data Action = Open String | Close String | Send String String
13-- data Action = Open String | Close String | Send String String
13-- connections : Signal Action -> Signal String
14-- connections : Signal Action -> Signal String