Update changelog.txt and latest RTS

This commit is contained in:
evancz 2012-10-21 04:55:01 -07:00
parent 84e8d80631
commit 38e9b8d382
2 changed files with 68 additions and 23 deletions

View file

@ -4,6 +4,11 @@ Release 0.4.1
* Add Automaton library.
* Add Dict and Set libraries.
* Remove the library prefixes `Data.` and `Signal.` because they were
more confusing than helpful.
* Add (,,) notation for creating tuples.
* Redo HTTP library, allowing any kind of request and more flexibility.
@ -11,6 +16,9 @@ Release 0.4.1
* The Haskell API exports the absolute path to the Elm runtime
system (with the corresponding version number).
* Better type error reporting for ambiguous uses of variables and for aliased modules.
* Add `readInt` and `readFloat` functions.
* Fix bug in pattern parsing.
* Ensure that `String` is treated as an alias of `[Char]`.
* Make pattern matching a bit more concise.

View file

@ -96,17 +96,29 @@ Elm.JSON = function() {
};
};
}
function lookup(key) { return function(obj) {
var k = JS.castStringToJSString(key);
return obj[1].hasOwnProperty(k) ? Just(obj[1][k]) : Nothing ;
};
}
function find(tipe,base) { return function (key) { return function(obj) {
var k = JS.castStringToJSString(key);
if (obj[1].hasOwnProperty(k)) {
var v = obj[1][k];
if (v[0] === tipe) { return v[1]; }
}
return base;
};
}
}
function lookupWithDefault(base) { return function(key) { return function(obj) {
var k = JS.castStringToJSString(key);
return obj[1].hasOwnProperty(k) ? obj[1][k] : base ;
};
};
}
function remove(k) { return function(inObj) {
var obj = inObj[1];
var outObj = {};
@ -192,6 +204,9 @@ Elm.JSON = function() {
singleton : singleton,
insert : insert,
lookup : lookup,
findString : find("JsonString",["Nil"]),
findObject : find("JsonObject", empty ),
findArray : find("JsonArray" ,["Nil"]),
findWithDefault : lookupWithDefault,
remove : remove,
toPrettyJSString : toPrettyJSString,
@ -264,7 +279,11 @@ var Value = function(){
arr[i] = spaces.join('');
}
}
return arr.join('');
arr = arr.join('');
if (arr[arr.length-1] === " ") {
return arr.slice(0,-1) + ' ';
}
return arr;
}
function properEscape(str) {
@ -400,7 +419,7 @@ var Value = function(){
} else if (v[0] === "Nil") {
return "[]";
} else if (v[0] === "JSON") {
return "(JSON.fromList " + toString(ElmJSON.toList(v)) + ")";
return "(JSON.fromList " + toString(Elm.JSON.toList(v)) + ")";
} else if (v[0] === "RBNode" || v[0] === "RBEmpty") {
function cons(k){ return function(v) { return function(acc) { return ["Cons",["Tuple2",k,v],acc]; }; }; }
return "(Map.fromList " + toString(Elm.Dict.fold(cons)(["Nil"])(v)) + ")";
@ -1035,26 +1054,6 @@ Elm.Dict=function(){
throw "Non-exhaustive pattern match in case";}();
}
throw "Non-exhaustive pattern match in case";}();};};};
function find_9(k_60){
return function(t_61){
return function(){
switch(t_61[0]){
case "RBEmpty":
return raise_5(Value.str("Key was not found in dictionary!"));
case "RBNode":
return function(){
var case6=compare(k_60)(t_61[2]);
switch(case6[0]){
case "EQ":
return t_61[3];
case "GT":
return find_9(k_60)(t_61[5]);
case "LT":
return find_9(k_60)(t_61[4]);
}
throw "Non-exhaustive pattern match in case";}();
}
throw "Non-exhaustive pattern match in case";}();};};
function member_10(k_66){
return function(t_67){
return isJust(lookup_7(k_66)(t_67));};};
@ -1456,7 +1455,7 @@ Elm.Dict=function(){
return ["Cons",["Tuple2",k_232,v_233],acc_234];};};})(["Nil"])(t_231);};
function fromList_42(assocs_235){
return List.foldl(uncurry(insert_20))(empty_4)(assocs_235);};
return {empty:empty_4,lookup:lookup_7,findWithDefault:findWithDefault_8,find:find_9,member:member_10,insert:insert_20,singleton:singleton_21,remove:remove_32,map:map_33,foldl:foldl_34,foldr:foldr_35,union:union_36,intersect:intersect_37,diff:diff_38,keys:keys_39,values:values_40,toList:toList_41,fromList:fromList_42};}();
return {empty:empty_4,lookup:lookup_7,findWithDefault:findWithDefault_8,member:member_10,insert:insert_20,singleton:singleton_21,remove:remove_32,map:map_33,foldl:foldl_34,foldr:foldr_35,union:union_36,intersect:intersect_37,diff:diff_38,keys:keys_39,values:values_40,toList:toList_41,fromList:fromList_42};}();
Elm.main=function(){
return Elm.Dict.main;};
} catch (e) {Elm.main=function() {var msg = ('<br/><h2>Your browser may not be supported. Are you using a modern browser?</h2>' + '<br/><span style="color:grey">Runtime Error in Dict module:<br/>' + e + '</span>');document.body.innerHTML = Text.monospace(msg);throw e;};}
@ -3379,6 +3378,42 @@ Elm.Prelude = function() {
};
var logBase=function(b){return function(x){return Math.log(x)/Math.log(b);};};
function readInt(str) {
var s = JavaScript.castStringToJSString(str);
var len = s.length;
if (len === 0) { return Nothing; }
var start = 0;
if (s[0] == '-') {
if (len === 1) { return Nothing; }
start = 1;
}
for (var i = start; i < len; ++i) {
if (!Char.isDigit(s[i])) { return Nothing; }
}
return Just(parseInt(s));
}
function readFloat(str) {
var s = JavaScript.castStringToJSString(str);
var len = s.length;
if (len === 0) { return Nothing; }
var start = 0;
if (s[0] == '-') {
if (len === 1) { return Nothing; }
start = 1;
}
var dotCount = 0;
for (var i = start; i < len; ++i) {
if (Char.isDigit(s[i])) { continue; }
if (s[i] === '.') {
dotCount += 1;
if (dotCount <= 1) { continue; }
}
return Nothing;
}
return Just(parseFloat(s));
}
return {eq : Value.eq,
id : function(x) { return x; },
@ -3398,6 +3433,8 @@ Elm.Prelude = function() {
floor : function(n) { return Math.floor(n); },
ceiling : function(n) { return Math.ceil(n); },
truncate : function(n) { return ~~n; },
readInt : readInt,
readFloat : readFloat,
sqrt : Math.sqrt,
abs : Math.abs,
pi : Math.PI,