@@ -255,6 +255,17 @@ var Value = function(){
256 return v[2];
256 return v[2];
259+ if (v[0] !== "Cons") {
260+ throw "Error: 'last' only accepts lists of length greater than one.";
263+ while (v[0] === "Cons") {
258 function map(f) {
269 function map(f) {
259 return function(xs) {
270 return function(xs) {
260 if (xs[0] === "Nil") { return xs; }
271 if (xs[0] === "Nil") { return xs; }
@@ -634,6 +645,7 @@ var Value = function(){
635 return {head:head,
646 return {head:head,
636 tail:tail,
647 tail:tail,
638 foldl:foldl,
650 foldl:foldl,
639 foldr:foldr,
651 foldr:foldr,
@@ -713,6 +725,7 @@ var Maybe = function() {
716var String = function() {
729var String = function() {
718 function append(s1) { return function(s2) {
731 function append(s1) { return function(s2) {
@@ -784,16 +797,14 @@ var String = function() {
784 concatMap : concatMap,
797 concatMap : concatMap,
785 forall : forall,
798 forall : forall,
786 exists : exists,
799 exists : exists,
788− filter : filter,
800+ //filter : filter,
792 toText : Value.toText,
803 toText : Value.toText,
793 properEscape : Value.properEscape
804 properEscape : Value.properEscape
797return {String: {toText:Value.toText, properEscape:Value.properEscape},
808return {String: {toText:Value.toText, properEscape:Value.properEscape},
798 Char:Char,
809 Char:Char,
799 Maybe:Maybe,
810 Maybe:Maybe,
@@ -1910,7 +1921,8 @@ var Signal = function() {
1910 button:button};
1921 button:button};
1924+ return {addListener:addListener,
1913− return {Mouse:Mouse,
1925+ Mouse:Mouse,
1914 Keyboard:Keyboard,
1926 Keyboard:Keyboard,
1915 Time:Time,
1927 Time:Time,
1916 Window:Window,
1928 Window:Window,
@@ -1992,6 +2004,7 @@ var Prelude = function() {
1992 filter : Data.List.filter,
2004 filter : Data.List.filter,
1993 head : Data.List.head,
2005 head : Data.List.head,
1994 tail : Data.List.tail,
2006 tail : Data.List.tail,
2007+ last : Data.List.last,
1995 length : Data.List.length,
2008 length : Data.List.length,
1996 reverse : Data.List.reverse,
2009 reverse : Data.List.reverse,
1997 foldr : Data.List.foldr,
2010 foldr : Data.List.foldr,
@@ -2028,6 +2041,12 @@ var Prelude = function() {
2029var eq = Value.eq;
2042var eq = Value.eq;
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; }
2031var includeGlobal = this;
2050var includeGlobal = this;
2032(function() {
2051(function() {
2033 var include = function(library) {
2052 var include = function(library) {