on master help sign in
Merge branch 'dev' of https://github.com/evancz/Elm into dev
commit8823b012d1fee9b18019ca048566a3b1ae762c5b authorevancz <info@elm-lang.org> dateFri 17 May 2013, 22:46 (13 years ago) parentc92dd2fdf73a09
4 files changed+11−9
libraries/Http.elm+1 libraries/Json.elm+5−5 libraries/Native/Json.js+2−1 libraries/Native/Signal/Http.js+3−3
libraries/Http.elm+1
@@ -5,6 +5,7 @@
55module Http where
66
77import Native.Http (send)
8+import Signal (lift)
89
910-- The datatype for responses. Success contains only the returned message.
1011-- Failures contain both an error code and an error message.
libraries/Json.elm+5−5
@@ -78,25 +78,25 @@ find get base =
7878
7979-- Find a string value in an Elm Json object. If the key is not found or the
8080-- value found is not a string, this returns the empty string.
81−findString : String -> Dict String Value -> String
81+findString : String -> Object -> String
8282findString = find string ""
8383
8484-- Find a number value in an Elm Json object. If the key is not found or the
8585-- value found is not a number, this returns 0
86−findNumber : String -> Dict String Value -> Float
86+findNumber : String -> Object -> Float
8787findNumber = find number 0
8888
8989-- Find a boolean value in an Elm Json object. If the key is not found or the
9090-- value found is not a boolean, this returns the False.
91−findBoolean : String -> Dict String Value -> Bool
91+findBoolean : String -> Object -> Bool
9292findBoolean = find boolean False
9393
9494-- Find an array value in an Elm Json object. If the key is not found or the
9595-- value found is not an array, this returns an empty list.
96−findArray : String -> Dict String Value -> [Value]
96+findArray : String -> Object -> [Value]
9797findArray = find array []
9898
9999-- Find an object value in an Elm Json object. If the key is not found or the
100100-- value found is not an object, this returns an empty object.
101−findObject : String -> Dict String Value -> Dict String Value
101+findObject : String -> Object -> Object
102102findObject = find object Dict.empty
libraries/Native/Json.js+2−1
@@ -6,6 +6,7 @@ Elm.Native.Json = function(elm) {
66 var Dict = Elm.Dict(elm);
77 var List = Elm.List(elm);
88 var JS = Elm.JavaScript(elm);
9+ var Utils = Elm.Native.Utils(elm);
910
1011 function fromValue(v) {
1112 switch (v.ctor) {
@@ -45,7 +46,7 @@ Elm.Native.Json = function(elm) {
4546 return { ctor:"Array", _0: JS.toList(v) };
4647 }
4748 var array = [];
48− for (var k in v) array.push(Tuple2(JS.toString(k), toValue(v[k])));
49+ for (var k in v) array.push(Utils.Tuple2(JS.toString(k), toValue(v[k])));
4950 return { ctor:"Object", _0: Dict.fromList(JS.toList(array)) };
5051 }
5152 }
libraries/Native/Signal/Http.js+3−3
@@ -18,9 +18,9 @@ Elm.Native.Http = function(elm) {
1818 function updateQueue(queue,responses) {
1919 if (queue.length > 0) {
2020 elm.notify(responses.id, queue[0].value);
21− if (queue[0].value.ctor !== Waiting) {
22− queue.shift();
23− setTimeout(function() { updateQueue(queue,responses); }, 0);
21+ if (queue[0].value.ctor !== 'Waiting') {
22+ queue.shift();
23+ setTimeout(function() { updateQueue(queue,responses); }, 0);
2424 }
2525 }
2626 }