@@ -255,6 +255,17 @@ var Value = function(){
255255 }
256256 return v[2];
257257 }
258+ function last(v) {
259+ if (v[0] !== "Cons") {
260+ throw "Error: 'last' only accepts lists of length greater than one.";
261+ }
262+ var out = v[1];
263+ while (v[0] === "Cons") {
264+ out = v[1];
265+ v = v[2];
266+ }
267+ return out;
268+ }
258269 function map(f) {
259270 return function(xs) {
260271 if (xs[0] === "Nil") { return xs; }
@@ -634,6 +645,7 @@ var Value = function(){
634645 }
635646 return {head:head,
636647 tail:tail,
648+ last:last,
637649 map:map,
638650 foldl:foldl,
639651 foldr:foldr,
@@ -713,6 +725,7 @@ var Maybe = function() {
713725 };
714726}();
715727
728+/*
716729var String = function() {
717730
718731 function append(s1) { return function(s2) {
@@ -784,16 +797,14 @@ var String = function() {
784797 concatMap : concatMap,
785798 forall : forall,
786799 exists : exists,
787− /*
788− filter : filter,
789− take:,
790− drop:,
791− */
800+ //filter : filter,
801+ //take:,
802+ //drop:,
792803 toText : Value.toText,
793804 properEscape : Value.properEscape
794805 };
795806}();
796−
807+*/
797808return {String: {toText:Value.toText, properEscape:Value.properEscape},
798809 Char:Char,
799810 Maybe:Maybe,
@@ -1910,7 +1921,8 @@ var Signal = function() {
19101921 button:button};
19111922 }();
19121923
1913− return {Mouse:Mouse,
1924+ return {addListener:addListener,
1925+ Mouse:Mouse,
19141926 Keyboard:Keyboard,
19151927 Time:Time,
19161928 Window:Window,
@@ -1992,6 +2004,7 @@ var Prelude = function() {
19922004 filter : Data.List.filter,
19932005 head : Data.List.head,
19942006 tail : Data.List.tail,
2007+ last : Data.List.last,
19952008 length : Data.List.length,
19962009 reverse : Data.List.reverse,
19972010 foldr : Data.List.foldr,
@@ -2028,6 +2041,12 @@ var Prelude = function() {
20282041}();
20292042var eq = Value.eq;
20302043
2044+Signal.addListener(document, 'elm_log', function(e) { console.log(e.value); });
2045+Signal.addListener(document, 'elm_title', function(e) { document.title = e.value; });
2046+Signal.addListener(document, 'elm_redirect', function(e) {
2047+ if (e.value.length > 0) { window.location = e.value; }
2048+ });
2049+
20312050var includeGlobal = this;
20322051(function() {
20332052 var include = function(library) {