Repository: sanctuary-js/sanctuary
Pull request #543 (2018-05-14 10:02:31)

replace S.toString with S.show
It feels good when a plan comes together. :)



Patch:
diff --git a/bower.json b/bower.json
index 23515e4..169d4b4 100644
--- a/bower.json
+++ b/bower.json
@@ -23,7 +23,7 @@
   ],
   "dependencies": {
     "sanctuary-def": "0.17.0",
-    "sanctuary-show": "1.0.x",
+    "sanctuary-show": "1.0.0",
     "sanctuary-type-classes": "8.2.1",
     "sanctuary-type-identifiers": "2.0.1"
   },
diff --git a/index.js b/index.js
index 49b81d8..d51c94e 100644
--- a/index.js
+++ b/index.js
@@ -183,20 +183,23 @@
   /* istanbul ignore else */
   if (typeof module === 'object' && typeof module.exports === 'object') {
     module.exports = f (require ('sanctuary-def'),
+                        require ('sanctuary-show'),
                         require ('sanctuary-type-classes'),
                         require ('sanctuary-type-identifiers'));
   } else if (typeof define === 'function' && define.amd != null) {
     define (['sanctuary-def',
+             'sanctuary-show',
              'sanctuary-type-classes',
              'sanctuary-type-identifiers'],
             f);
   } else {
     self.sanctuary = f (self.sanctuaryDef,
+                        self.sanctuaryShow,
                         self.sanctuaryTypeClasses,
                         self.sanctuaryTypeIdentifiers);
   }
 
-} (function($, Z, type) {
+} (function($, show, Z, type) {
 
   'use strict';
 
@@ -386,6 +389,7 @@
   //.
   //. const Identity$prototype = {
   //.   'constructor': Identity,
+  //.   '@@show': function() { return `Identity (${S.show (this.value)})`; },
   //.   'fantasy-land/map': function(f) { return Identity (f (this.value)); },
   //. };
   //.
@@ -477,7 +481,7 @@
   //. See also [`create`](#create).
   //.
   //. ```javascript
-  //. > S.unchecked.map (S.toString) ({x: 'foo', y: true, z: 42})
+  //. > S.unchecked.map (S.show) ({x: 'foo', y: true, z: 42})
   //. {x: '"foo"', y: 'true', z: '42'}
   //. ```
   //.
@@ -530,27 +534,27 @@
 
   //. ### Showable
 
-  //# toString :: Any -> String
+  //# show :: Any -> String
   //.
-  //. Alias of [`Z.toString`][].
+  //. Alias of [`show`][].
   //.
   //. ```javascript
-  //. > S.toString (-0)
+  //. > S.show (-0)
   //. '-0'
   //.
-  //. > S.toString (['foo', 'bar', 'baz'])
+  //. > S.show (['foo', 'bar', 'baz'])
   //. '["foo", "bar", "baz"]'
   //.
-  //. > S.toString ({x: 1, y: 2, z: 3})
+  //. > S.show ({x: 1, y: 2, z: 3})
   //. '{"x": 1, "y": 2, "z": 3}'
   //.
-  //. > S.toString (S.Left (S.Right (S.Just (S.Nothing))))
-  //. 'Left(Right(Just(Nothing)))'
+  //. > S.show (S.Left (S.Right (S.Just (S.Nothing))))
+  //. 'Left (Right (Just (Nothing)))'
   //. ```
-  _.toString = {
+  _.show = {
     consts: {},
     types: [$.Any, $.String],
-    impl: Z.toString
+    impl: show
   };
 
   //. ### Fantasy Land
@@ -1859,19 +1863,19 @@
   //. false
   //. ```
 
-  //# Maybe#toString :: Maybe a ~> () -> String
+  //# Maybe#@@show :: Maybe a ~> () -> String
   //.
   //. Returns the string representation of the Maybe.
   //.
   //. ```javascript
-  //. > S.toString (S.Nothing)
+  //. > S.show (S.Nothing)
   //. 'Nothing'
   //.
-  //. > S.toString (S.Just ([1, 2, 3]))
-  //. 'Just([1, 2, 3])'
+  //. > S.show (S.Just ([1, 2, 3]))
+  //. 'Just ([1, 2, 3])'
   //. ```
-  Maybe.prototype.toString = function() {
-    return this.isJust ? 'Just(' + Z.toString (this.value) + ')' : 'Nothing';
+  Maybe.prototype['@@show'] = function() {
+    return this.isJust ? 'Just (' + show (this.value) + ')' : 'Nothing';
   };
 
   //# Maybe#inspect :: Maybe a ~> () -> String
@@ -1879,16 +1883,16 @@
   //. Returns the string representation of the Maybe. This method is used by
   //. `util.inspect` and the REPL to format a Maybe for display.
   //.
-  //. See also [`Maybe#toString`][].
+  //. See also [`Maybe#@@show`][].
   //.
   //. ```javascript
   //. > S.Nothing.inspect ()
   //. 'Nothing'
   //.
   //. > (S.Just ([1, 2, 3])).inspect ()
-  //. 'Just([1, 2, 3])'
+  //. 'Just ([1, 2, 3])'
   //. ```
-  Maybe.prototype.inspect = function() { return this.toString (); };
+  Maybe.prototype.inspect = function() { return show (this); };
 
   //# Maybe#fantasy-land/equals :: Setoid a => Maybe a ~> Maybe a -> Boolean
   //.
@@ -2570,20 +2574,19 @@
   //. false
   //. ```
 
-  //# Either#toString :: Either a b ~> () -> String
+  //# Either#@@show :: Either a b ~> () -> String
   //.
   //. Returns the string representation of the Either.
   //.
   //. ```javascript
-  //. > S.toString (S.Left ('Cannot divide by zero'))
-  //. 'Left("Cannot divide by zero")'
+  //. > S.show (S.Left ('Cannot divide by zero'))
+  //. 'Left ("Cannot divide by zero")'
   //.
-  //. > S.toString (S.Right ([1, 2, 3]))
-  //. 'Right([1, 2, 3])'
+  //. > S.show (S.Right ([1, 2, 3]))
+  //. 'Right ([1, 2, 3])'
   //. ```
-  Either.prototype.toString = function() {
-    return (this.isLeft ? 'Left' : 'Right') +
-           '(' + Z.toString (this.value) + ')';
+  Either.prototype['@@show'] = function() {
+    return (this.isLeft ? 'Left' : 'Right') + ' (' + show (this.value) + ')';
   };
 
   //# Either#inspect :: Either a b ~> () -> String
@@ -2591,16 +2594,16 @@
   //. Returns the string representation of the Either. This method is used by
   //. `util.inspect` and the REPL to format a Either for display.
   //.
-  //. See also [`Either#toString`][].
+  //. See also [`Either#@@show`][].
   //.
   //. ```javascript
   //. > (S.Left ('Cannot divide by zero')).inspect ()
-  //. 'Left("Cannot divide by zero")'
+  //. 'Left ("Cannot divide by zero")'
   //.
   //. > (S.Right ([1, 2, 3])).inspect ()
-  //. 'Right([1, 2, 3])'
+  //. 'Right ([1, 2, 3])'
   //. ```
-  Either.prototype.inspect = function() { return this.toString (); };
+  Either.prototype.inspect = function() { return show (this); };
 
   //# Either#fantasy-land/equals :: (Setoid a, Setoid b) => Either a b ~> Either a b -> Boolean
   //.
@@ -2993,10 +2996,10 @@
   //. Right's value, if the Either is a Right.
   //.
   //. ```javascript
-  //. > S.either (S.toUpper) (S.toString) (S.Left ('Cannot divide by zero'))
+  //. > S.either (S.toUpper) (S.show) (S.Left ('Cannot divide by zero'))
   //. 'CANNOT DIVIDE BY ZERO'
   //.
-  //. > S.either (S.toUpper) (S.toString) (S.Right (42))
+  //. > S.either (S.toUpper) (S.show) (S.Right (42))
   //. '42'
   //. ```
   function either(l) {
@@ -4110,7 +4113,7 @@
       var obj = toObject (x);
       if (key in obj) return obj[key];
       throw new TypeError ('‘prop’ expected object to have a property named ' +
-                           '‘' + key + '’; ' + Z.toString (x) + ' does not');
+                           '‘' + key + '’; ' + show (x) + ' does not');
     };
   }
   _.prop = {
@@ -4138,8 +4141,7 @@
         var obj = toObject (x);
         if (key in obj) return obj[key];
         throw new TypeError ('‘props’ expected object to have a property at ' +
-                             Z.toString (path) + '; ' +
-                             Z.toString (x) + ' does not');
+                             show (path) + '; ' + show (x) + ' does not');
       }, x);
     };
   }
@@ -5265,10 +5267,10 @@
 //. [`Z.reject`]:           v:sanctuary-js/sanctuary-type-classes#reject
 //. [`Z.sequence`]:         v:sanctuary-js/sanctuary-type-classes#sequence
 //. [`Z.takeWhile`]:        v:sanctuary-js/sanctuary-type-classes#takeWhile
-//. [`Z.toString`]:         v:sanctuary-js/sanctuary-type-classes#toString
 //. [`Z.traverse`]:         v:sanctuary-js/sanctuary-type-classes#traverse
 //. [`Z.zero`]:             v:sanctuary-js/sanctuary-type-classes#zero
 //. [`of`]:                 v:fantasyland/fantasy-land#of-method
+//. [`show`]:               v:sanctuary-js/sanctuary-show#show
 //. [equivalence]:          https://en.wikipedia.org/wiki/Equivalence_relation
 //. [iff]:                  https://en.wikipedia.org/wiki/If_and_only_if
 //. [parseInt]:             https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt
@@ -5278,7 +5280,7 @@
 //. [type identifier]:      v:sanctuary-js/sanctuary-type-identifiers
 //. [type representative]:  v:fantasyland/fantasy-land#type-representatives
 //.
+//. [`Either#@@show`]:                  #Either.prototype.@@show
 //. [`Either#fantasy-land/bimap`]:      #Either.prototype.fantasy-land/bimap
 //. [`Either#fantasy-land/map`]:        #Either.prototype.fantasy-land/map
-//. [`Either#toString`]:                #Either.prototype.toString
-//. [`Maybe#toString`]:                 #Maybe.prototype.toString
+//. [`Maybe#@@show`]:                   #Maybe.prototype.@@show
diff --git a/package.json b/package.json
index 5eb1f1d..e1627e9 100644
--- a/package.json
+++ b/package.json
@@ -15,7 +15,7 @@
   },
   "dependencies": {
     "sanctuary-def": "0.17.0",
-    "sanctuary-show": "1.0.x",
+    "sanctuary-show": "1.0.0",
     "sanctuary-type-classes": "8.2.1",
     "sanctuary-type-identifiers": "2.0.1"
   },


Test patch:
diff --git a/test/Either/Left.js b/test/Either/Left.js
index e5066a2..0cb08d7 100644
--- a/test/Either/Left.js
+++ b/test/Either/Left.js
@@ -93,14 +93,13 @@ suite ('Left', function() {
     eq ((S.Left ('abc'))[FL.reduce] (function(x, y) { return x - y; }, 42)) (42);
   });
 
-  test ('"toString" method', function() {
-    eq ((S.Left ('abc')).toString.length) (0);
-    eq ((S.Left ('abc')).toString ()) ('Left("abc")');
+  test ('"@@show" method', function() {
+    eq (S.show (S.Left ('abc'))) ('Left ("abc")');
   });
 
   test ('"inspect" method', function() {
     eq ((S.Left ('abc')).inspect.length) (0);
-    eq ((S.Left ('abc')).inspect ()) ('Left("abc")');
+    eq ((S.Left ('abc')).inspect ()) ('Left ("abc")');
   });
 
 });
diff --git a/test/Either/Right.js b/test/Either/Right.js
index 564c924..939c70c 100644
--- a/test/Either/Right.js
+++ b/test/Either/Right.js
@@ -93,14 +93,13 @@ suite ('Right', function() {
     eq ((S.Right (5))[FL.reduce] (function(x, y) { return x - y; }, 42)) (37);
   });
 
-  test ('"toString" method', function() {
-    eq ((S.Right ([1, 2, 3])).toString.length) (0);
-    eq ((S.Right ([1, 2, 3])).toString ()) ('Right([1, 2, 3])');
+  test ('"@@show" method', function() {
+    eq (S.show (S.Right ([1, 2, 3]))) ('Right ([1, 2, 3])');
   });
 
   test ('"inspect" method', function() {
     eq ((S.Right ([1, 2, 3])).inspect.length) (0);
-    eq ((S.Right ([1, 2, 3])).inspect ()) ('Right([1, 2, 3])');
+    eq ((S.Right ([1, 2, 3])).inspect ()) ('Right ([1, 2, 3])');
   });
 
 });
diff --git a/test/Maybe/Just.js b/test/Maybe/Just.js
index 6d8d76a..b569f88 100644
--- a/test/Maybe/Just.js
+++ b/test/Maybe/Just.js
@@ -85,14 +85,13 @@ suite ('Just', function() {
     eq ((S.Just (5))[FL.reduce] (function(x, y) { return x - y; }, 42)) (37);
   });
 
-  test ('"toString" method', function() {
-    eq ((S.Just ([1, 2, 3])).toString.length) (0);
-    eq ((S.Just ([1, 2, 3])).toString ()) ('Just([1, 2, 3])');
+  test ('"@@show" method', function() {
+    eq (S.show (S.Just ([1, 2, 3]))) ('Just ([1, 2, 3])');
   });
 
   test ('"inspect" method', function() {
     eq ((S.Just ([1, 2, 3])).inspect.length) (0);
-    eq ((S.Just ([1, 2, 3])).inspect ()) ('Just([1, 2, 3])');
+    eq ((S.Just ([1, 2, 3])).inspect ()) ('Just ([1, 2, 3])');
   });
 
 });
diff --git a/test/Maybe/Nothing.js b/test/Maybe/Nothing.js
index adef502..bb96eea 100644
--- a/test/Maybe/Nothing.js
+++ b/test/Maybe/Nothing.js
@@ -72,9 +72,8 @@ suite ('Nothing', function() {
     eq (S.Nothing[FL.reduce] (function(x, y) { return x - y; }, 42)) (42);
   });
 
-  test ('"toString" method', function() {
-    eq (S.Nothing.toString.length) (0);
-    eq (S.Nothing.toString ()) ('Nothing');
+  test ('"@@show" method', function() {
+    eq (S.show (S.Nothing)) ('Nothing');
   });
 
   test ('"inspect" method', function() {
diff --git a/test/internal/EitherArb.js b/test/internal/EitherArb.js
index baa8411..81f2f02 100644
--- a/test/internal/EitherArb.js
+++ b/test/internal/EitherArb.js
@@ -4,11 +4,9 @@ var jsc = require ('jsverify');
 
 var S = require ('./sanctuary');
 
-var toString = require ('./toString');
-
 
 //  EitherArb :: Arbitrary a -> Arbitrary b -> Arbitrary (Either a b)
 module.exports = function EitherArb(lArb, rArb) {
-  return jsc.oneof (lArb.smap (S.Left, S.prop ('value'), toString),
-                    rArb.smap (S.Right, S.prop ('value'), toString));
+  return jsc.oneof (lArb.smap (S.Left, S.prop ('value'), S.show),
+                    rArb.smap (S.Right, S.prop ('value'), S.show));
 };
diff --git a/test/internal/Identity.js b/test/internal/Identity.js
index d7b1431..f43e7d2 100644
--- a/test/internal/Identity.js
+++ b/test/internal/Identity.js
@@ -1,11 +1,11 @@
 'use strict';
 
 var FL = require ('fantasy-land');
+var show = require ('sanctuary-show');
 
 var concat = require ('./concat');
 var equals = require ('./equals');
 var map = require ('./map');
-var toString = require ('./toString');
 
 
 //  Identity :: a -> Identity a
@@ -55,8 +55,8 @@ Identity.prototype[FL.extract] = function() {
 };
 
 Identity.prototype.inspect =
-Identity.prototype.toString = function() {
-  return 'Identity(' + toString (this.value) + ')';
+Identity.prototype['@@show'] = function() {
+  return 'Identity (' + show (this.value) + ')';
 };
 
 module.exports = Identity;
diff --git a/test/internal/IdentityArb.js b/test/internal/IdentityArb.js
index 45870ca..91166ec 100644
--- a/test/internal/IdentityArb.js
+++ b/test/internal/IdentityArb.js
@@ -3,10 +3,9 @@
 var S = require ('./sanctuary');
 
 var Identity = require ('./Identity');
-var toString = require ('./toString');
 
 
 //  IdentityArb :: Arbitrary a -> Arbitrary (Identity a)
 module.exports = function IdentityArb(arb) {
-  return arb.smap (Identity, S.prop ('value'), toString);
+  return arb.smap (Identity, S.prop ('value'), S.show);
 };
diff --git a/test/internal/List.js b/test/internal/List.js
index e1712e2..8f27f2e 100644
--- a/test/internal/List.js
+++ b/test/internal/List.js
@@ -2,6 +2,7 @@
 
 var FL = require ('fantasy-land');
 var $ = require ('sanctuary-def');
+var show = require ('sanctuary-show');
 var Z = require ('sanctuary-type-classes');
 var type = require ('sanctuary-type-identifiers');
 
@@ -105,10 +106,10 @@ List.prototype[FL.traverse] = function(typeRep, f) {
 };
 
 List.prototype.inspect =
-List.prototype.toString = function() {
+List.prototype['@@show'] = function() {
   return this.isNil ?
     'Nil' :
-    'Cons (' + Z.toString (this.head) + ') (' + Z.toString (this.tail) + ')';
+    'Cons (' + show (this.head) + ') (' + show (this.tail) + ')';
 };
 
 module.exports = List;
diff --git a/test/internal/MaybeArb.js b/test/internal/MaybeArb.js
index fe825bb..65ae717 100644
--- a/test/internal/MaybeArb.js
+++ b/test/internal/MaybeArb.js
@@ -4,11 +4,9 @@ var jsc = require ('jsverify');
 
 var S = require ('./sanctuary');
 
-var toString = require ('./toString');
-
 
 //  MaybeArb :: Arbitrary a -> Arbitrary (Maybe a)
 module.exports = function MaybeArb(arb) {
-  return jsc.oneof (arb.smap (S.Just, S.prop ('value'), toString),
+  return jsc.oneof (arb.smap (S.Just, S.prop ('value'), S.show),
                     jsc.constant (S.Nothing));
 };
diff --git a/test/internal/Sum.js b/test/internal/Sum.js
index 7054b02..c339619 100644
--- a/test/internal/Sum.js
+++ b/test/internal/Sum.js
@@ -2,6 +2,7 @@
 
 var FL = require ('fantasy-land');
 var $ = require ('sanctuary-def');
+var show = require ('sanctuary-show');
 var Z = require ('sanctuary-type-classes');
 var type = require ('sanctuary-type-identifiers');
 
@@ -35,8 +36,8 @@ Sum.prototype[FL.invert] = function() {
 };
 
 Sum.prototype.inspect =
-Sum.prototype.toString = function() {
-  return 'Sum(' + Z.toString (this.value) + ')';
+Sum.prototype['@@show'] = function() {
+  return 'Sum (' + show (this.value) + ')';
 };
 
 module.exports = Sum;
diff --git a/test/internal/Useless.js b/test/internal/Useless.js
index 5aa3e5d..95531b3 100644
--- a/test/internal/Useless.js
+++ b/test/internal/Useless.js
@@ -3,6 +3,5 @@
 //  Useless :: Useless
 module.exports = {
   constructor: {'@@type': 'sanctuary/Useless'},
-  inspect: function() { return 'Useless'; },
-  toString: function() { return 'Useless'; }
+  inspect: function() { return 'Useless'; }
 };
diff --git a/test/internal/eq.js b/test/internal/eq.js
index e031df9..d209c49 100644
--- a/test/internal/eq.js
+++ b/test/internal/eq.js
@@ -2,15 +2,16 @@
 
 var assert = require ('assert');
 
+var show = require ('sanctuary-show');
+
 var equals = require ('./equals');
-var toString = require ('./toString');
 
 //  eq :: a -> b -> Undefined !
 module.exports = function eq(actual) {
   assert.strictEqual (arguments.length, eq.length);
   return function eq$1(expected) {
     assert.strictEqual (arguments.length, eq$1.length);
-    assert.strictEqual (toString (actual), toString (expected));
+    assert.strictEqual (show (actual), show (expected));
     assert.strictEqual (equals (actual) (expected), true);
   };
 };
diff --git a/test/internal/toString.js b/test/internal/toString.js
deleted file mode 100644
index 63d0ce0..0000000
--- a/test/internal/toString.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-var Z = require ('sanctuary-type-classes');
-
-//  toString :: a -> String
-module.exports = Z.toString;
diff --git a/test/show.js b/test/show.js
new file mode 100644
index 0000000..e277d53
--- /dev/null
+++ b/test/show.js
@@ -0,0 +1,57 @@
+'use strict';
+
+var S = require ('..');
+
+var eq = require ('./internal/eq');
+
+
+test ('show', function() {
+
+  eq (typeof S.show) ('function');
+  eq (S.show.length) (1);
+  eq (String (S.show)) ('show :: Any -> String');
+
+  eq (S.show (null)) ('null');
+  eq (S.show (undefined)) ('undefined');
+  eq (S.show (false)) ('false');
+  eq (S.show (true)) ('true');
+  eq (S.show (new Boolean (false))) ('new Boolean (false)');
+  eq (S.show (new Boolean (true))) ('new Boolean (true)');
+  eq (S.show (0)) ('0');
+  eq (S.show (-0)) ('-0');
+  eq (S.show (NaN)) ('NaN');
+  eq (S.show (Math.PI)) ('3.141592653589793');
+  eq (S.show (-Math.PI)) ('-3.141592653589793');
+  eq (S.show (Infinity)) ('Infinity');
+  eq (S.show (-Infinity)) ('-Infinity');
+  eq (S.show (new Number (0))) ('new Number (0)');
+  eq (S.show (new Number (-0))) ('new Number (-0)');
+  eq (S.show (new Number (NaN))) ('new Number (NaN)');
+  eq (S.show (new Number (Math.PI))) ('new Number (3.141592653589793)');
+  eq (S.show (new Number (-Math.PI))) ('new Number (-3.141592653589793)');
+  eq (S.show (new Number (Infinity))) ('new Number (Infinity)');
+  eq (S.show (new Number (-Infinity))) ('new Number (-Infinity)');
+  eq (S.show ('')) ('""');
+  eq (S.show ('foo')) ('"foo"');
+  eq (S.show ('foo "bar" baz')) ('"foo \\"bar\\" baz"');
+  eq (S.show (new String (''))) ('new String ("")');
+  eq (S.show (new String ('foo'))) ('new String ("foo")');
+  eq (S.show (new String ('foo "bar" baz'))) ('new String ("foo \\"bar\\" baz")');
+  eq (S.show (new Date (0))) ('new Date ("1970-01-01T00:00:00.000Z")');
+  eq (S.show (new Date (42))) ('new Date ("1970-01-01T00:00:00.042Z")');
+  eq (S.show (new Date (NaN))) ('new Date (NaN)');
+  eq (S.show (new Date ('2001-02-03'))) ('new Date ("2001-02-03T00:00:00.000Z")');
+  eq (S.show ([])) ('[]');
+  eq (S.show (['foo'])) ('["foo"]');
+  eq (S.show (['foo', 'bar', 'baz'])) ('["foo", "bar", "baz"]');
+  eq (S.show (['foo "bar" baz'])) ('["foo \\"bar\\" baz"]');
+  eq (S.show ({})) ('{}');
+  eq (S.show ({x: 1})) ('{"x": 1}');
+  eq (S.show ({x: 1, y: 2, z: 3})) ('{"x": 1, "y": 2, "z": 3}');
+  eq (S.show ({'foo "bar" baz': '"quux"'})) ('{"foo \\"bar\\" baz": "\\"quux\\""}');
+  eq (S.show (S.Nothing)) ('Nothing');
+  eq (S.show (S.Just (9))) ('Just (9)');
+  eq (S.show (S.Left (false))) ('Left (false)');
+  eq (S.show (S.Right (true))) ('Right (true)');
+
+});
diff --git a/test/toString.js b/test/toString.js
deleted file mode 100644
index 8bae86c..0000000
--- a/test/toString.js
+++ /dev/null
@@ -1,57 +0,0 @@
-'use strict';
-
-var S = require ('..');
-
-var eq = require ('./internal/eq');
-
-
-test ('toString', function() {
-
-  eq (typeof S.toString) ('function');
-  eq (S.toString.length) (1);
-  eq (String (S.toString)) ('toString :: Any -> String');
-
-  eq (S.toString (null)) ('null');
-  eq (S.toString (undefined)) ('undefined');
-  eq (S.toString (false)) ('false');
-  eq (S.toString (true)) ('true');
-  eq (S.toString (new Boolean (false))) ('new Boolean(false)');
-  eq (S.toString (new Boolean (true))) ('new Boolean(true)');
-  eq (S.toString (0)) ('0');
-  eq (S.toString (-0)) ('-0');
-  eq (S.toString (NaN)) ('NaN');
-  eq (S.toString (Math.PI)) ('3.141592653589793');
-  eq (S.toString (-Math.PI)) ('-3.141592653589793');
-  eq (S.toString (Infinity)) ('Infinity');
-  eq (S.toString (-Infinity)) ('-Infinity');
-  eq (S.toString (new Number (0))) ('new Number(0)');
-  eq (S.toString (new Number (-0))) ('new Number(-0)');
-  eq (S.toString (new Number (NaN))) ('new Number(NaN)');
-  eq (S.toString (new Number (Math.PI))) ('new Number(3.141592653589793)');
-  eq (S.toString (new Number (-Math.PI))) ('new Number(-3.141592653589793)');
-  eq (S.toString (new Number (Infinity))) ('new Number(Infinity)');
-  eq (S.toString (new Number (-Infinity))) ('new Number(-Infinity)');
-  eq (S.toString ('')) ('""');
-  eq (S.toString ('foo')) ('"foo"');
-  eq (S.toString ('foo "bar" baz')) ('"foo \\"bar\\" baz"');
-  eq (S.toString (new String (''))) ('new String("")');
-  eq (S.toString (new String ('foo'))) ('new String("foo")');
-  eq (S.toString (new String ('foo "bar" baz'))) ('new String("foo \\"bar\\" baz")');
-  eq (S.toString (new Date (0))) ('new Date("1970-01-01T00:00:00.000Z")');
-  eq (S.toString (new Date (42))) ('new Date("1970-01-01T00:00:00.042Z")');
-  eq (S.toString (new Date (NaN))) ('new Date(NaN)');
-  eq (S.toString (new Date ('2001-02-03'))) ('new Date("2001-02-03T00:00:00.000Z")');
-  eq (S.toString ([])) ('[]');
-  eq (S.toString (['foo'])) ('["foo"]');
-  eq (S.toString (['foo', 'bar', 'baz'])) ('["foo", "bar", "baz"]');
-  eq (S.toString (['foo "bar" baz'])) ('["foo \\"bar\\" baz"]');
-  eq (S.toString ({})) ('{}');
-  eq (S.toString ({x: 1})) ('{"x": 1}');
-  eq (S.toString ({x: 1, y: 2, z: 3})) ('{"x": 1, "y": 2, "z": 3}');
-  eq (S.toString ({'foo "bar" baz': '"quux"'})) ('{"foo \\"bar\\" baz": "\\"quux\\""}');
-  eq (S.toString (S.Nothing)) ('Nothing');
-  eq (S.toString (S.Just (9))) ('Just(9)');
-  eq (S.toString (S.Left (false))) ('Left(false)');
-  eq (S.toString (S.Right (true))) ('Right(true)');
-
-});