From d6acc289ab460fac841be3c08a212ec44a0c674b Mon Sep 17 00:00:00 2001 From: Eric Landuyt <6954689+EricLanduyt@users.noreply.github.com> Date: Sun, 3 Nov 2019 11:30:54 +0100 Subject: [PATCH 01/10] sanctuary ^1.0.0, sanctuary-def ^0.19.0, sanctuary-show ^1.0.0 --- package.json | 6 ++--- yarn.lock | 67 ++++++++++++++++++++++++++++++++-------------------- 2 files changed, 44 insertions(+), 29 deletions(-) diff --git a/package.json b/package.json index a17d45f..48200ff 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,8 @@ "fantasy-land": "^3.5.0", "hm-parser": "^0.1.5", "mem": "^4.0.0", - "sanctuary": "^0.15.0", - "sanctuary-def": "^0.18.1", + "sanctuary": "^1.0.0", + "sanctuary-def": "^0.19.0", "sanctuary-show": "^1.0.0" }, "devDependencies": { @@ -41,7 +41,7 @@ "jsverify": "^0.8.3", "mocha": "^5.2.0", "sanctuary-style": "^2.0.0", - "sanctuary-type-classes": "^9.0.0", + "sanctuary-type-classes": "^10.0.0", "xyz": "3.0.x" } } diff --git a/yarn.lock b/yarn.lock index 88faab3..484c70d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2944,17 +2944,17 @@ safe-regex@^1.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sanctuary-def@0.18.1, sanctuary-def@^0.18.1: - version "0.18.1" - resolved "https://registry.yarnpkg.com/sanctuary-def/-/sanctuary-def-0.18.1.tgz#580af82a3fbbd651e8dddc0ab34b11727ef63b5f" - integrity sha512-Ltu/gU5ZskRln8NI6YJru5JbpkcMe4XqFx5zJMZysTKPmOVkETys5eVvZmclNLzPNrOIPvqBGJtD/D2q9yvP/A== +sanctuary-def@0.19.0, sanctuary-def@^0.19.0: + version "0.19.0" + resolved "https://registry.yarnpkg.com/sanctuary-def/-/sanctuary-def-0.19.0.tgz#84dd038f723512168028654dd89563cbbf3a34af" + integrity sha512-1ZJX4LC3Kh4B9bnGGCN8qQS7GrHltLtibQnsaFqaoUpKIT4qCfUuCy/Beke352E948+lmquowyDfkMHtZ/0m3w== dependencies: sanctuary-either "1.0.x" sanctuary-show "1.0.x" - sanctuary-type-classes "9.0.x" + sanctuary-type-classes "10.0.x" sanctuary-type-identifiers "2.0.x" -sanctuary-either@1.0.0, sanctuary-either@1.0.x: +sanctuary-either@1.0.x: version "1.0.0" resolved "https://registry.yarnpkg.com/sanctuary-either/-/sanctuary-either-1.0.0.tgz#b6041e54c639700048be757ba4d6c026c2c2f67c" integrity sha512-j4WAlwILU83wawXJQCSh5kVK27gxOykMuCfUfUOba/qUcFE+FxwHkt7lnHVYDjt7jG9SENe8bTQzPH/Zmhy3Ag== @@ -2962,21 +2962,29 @@ sanctuary-either@1.0.0, sanctuary-either@1.0.x: sanctuary-show "1.0.x" sanctuary-type-classes "9.0.0" -sanctuary-maybe@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/sanctuary-maybe/-/sanctuary-maybe-1.0.0.tgz#03cd226d933ec89270e4495a965733390e843afc" - integrity sha512-4TUjIxznxTZ1dh8Zw4PRhaVkzY8KIZ4GGsOXBytOSV83MRRGkuz7wJHj3bfh2i9lOekbjf0Oal6v7IF6uDiYvg== +sanctuary-either@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/sanctuary-either/-/sanctuary-either-1.1.0.tgz#9d45b344d870c16fc72f574feec1744dc50f4e1f" + integrity sha512-tQewdQTPKzuJGahV5iuILJM96I+AfIFn3vpi0s2FhHYENbRqO4JeFSWLNT1mJ9SupSJBopgWefWeUjq/ZKfdtg== dependencies: sanctuary-show "1.0.x" - sanctuary-type-classes "9.0.0" + sanctuary-type-classes "10.0.0" -sanctuary-pair@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/sanctuary-pair/-/sanctuary-pair-1.0.0.tgz#eaf8121f0ba3064e5e0b09bb624bc3885209886a" - integrity sha512-fqXCO6boMLW7ZHrjc573u5maNdytIrNxeaotBBGrvbEVqiNeA6VH4eGARMLTCRdgOtW94aF5EUkBZCzvXLSujQ== +sanctuary-maybe@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/sanctuary-maybe/-/sanctuary-maybe-1.1.0.tgz#b4b6807d949dc56fbc30834aebb925de1a05cddf" + integrity sha512-MwHsfddXxfn7Ywy9hiRIA/+lbJBUKeKI/cSHwTKkbLkelSBhSpBgZZI4giSZRwbP9OpxOpbkS+rFc//+HCVwdw== dependencies: sanctuary-show "1.0.x" - sanctuary-type-classes "9.0.0" + sanctuary-type-classes "10.0.0" + +sanctuary-pair@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/sanctuary-pair/-/sanctuary-pair-1.1.0.tgz#5a0d3d54ba2a1ebcd3a0bf3a2bc7c86c085a36ed" + integrity sha512-lr+lTHZCzKD3PAS8YHB0YhVLsKIRIzoeIg5SBWYquXgabVdVShOT+J+7E3cg4v+FOpgN1HWguYQcbJczCSEVyQ== + dependencies: + sanctuary-show "1.0.x" + sanctuary-type-classes "10.0.0" sanctuary-show@1.0.0, sanctuary-show@1.0.x, sanctuary-show@^1.0.0: version "1.0.0" @@ -2988,7 +2996,14 @@ sanctuary-style@^2.0.0: resolved "https://registry.yarnpkg.com/sanctuary-style/-/sanctuary-style-2.0.0.tgz#83d023a340641bcc1d27acee013c098b12075586" integrity sha512-5g3UnBDY3419ipokMa/PXY9DM7XVU7sUMq3RMHRKnbqS9KYKWYvysljb8/rHi+bWut5n1omWEQJEyKUHY+482w== -sanctuary-type-classes@9.0.0, sanctuary-type-classes@9.0.x, sanctuary-type-classes@^9.0.0: +sanctuary-type-classes@10.0.0, sanctuary-type-classes@10.0.x, sanctuary-type-classes@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/sanctuary-type-classes/-/sanctuary-type-classes-10.0.0.tgz#25126f009348101dbe627c7b7efb7c6f63f792b1" + integrity sha512-h5Q1VkW/CmVbmoWDf6HdsgJbx5gc3n6R5lRzzKRssYSkghmqEuAr+0ThJs/bqJK8aiQwh3N2PXP4ZppYEDlSdg== + dependencies: + sanctuary-type-identifiers "2.0.1" + +sanctuary-type-classes@9.0.0: version "9.0.0" resolved "https://registry.yarnpkg.com/sanctuary-type-classes/-/sanctuary-type-classes-9.0.0.tgz#b44741ca67fa650cbd314e1ad318d730ce1309a4" integrity sha512-rFW27f3D622kxKravpGU9OjWn66fnDjDjGPvoYo4hEoBg2ocypvp0R9cs0YovKL3jTO+PTceUBh5tYZ+l9ay3g== @@ -3005,17 +3020,17 @@ sanctuary-type-identifiers@2.0.1, sanctuary-type-identifiers@2.0.x: resolved "https://registry.yarnpkg.com/sanctuary-type-identifiers/-/sanctuary-type-identifiers-2.0.1.tgz#fc524cf6dd92cebfcbb0dd9509eff193159a20ed" integrity sha1-/FJM9t2Szr/LsN2VCe/xkxWaIO0= -sanctuary@^0.15.0: - version "0.15.0" - resolved "https://registry.yarnpkg.com/sanctuary/-/sanctuary-0.15.0.tgz#a4b9bf7a43bad928dce3e7aa590fbf30681b9ebd" - integrity sha512-cyrFHazodEFlv6qVX/+qujO+jly2MXRMyNXR61jaqJG42JlCJnKpgQGvebYINaiRUbZ+P5Dr2Ai3Tg+vzNYCUw== +sanctuary@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/sanctuary/-/sanctuary-1.0.0.tgz#ecddfd453290b4e269fdc4bb8314e3c25febc79d" + integrity sha512-H+C80DadljM0gyWe5Y3R8bDIDW8MU8/XBg0h0V2zwusmljRAVrBQshd6XU3zFxk+lHj04e9xoUvBscRfl8vO8g== dependencies: - sanctuary-def "0.18.1" - sanctuary-either "1.0.0" - sanctuary-maybe "1.0.0" - sanctuary-pair "1.0.0" + sanctuary-def "0.19.0" + sanctuary-either "1.1.0" + sanctuary-maybe "1.1.0" + sanctuary-pair "1.1.0" sanctuary-show "1.0.0" - sanctuary-type-classes "9.0.0" + sanctuary-type-classes "10.0.0" sanctuary-type-identifiers "2.0.1" sax@^1.2.4: From 2665182a8be3198ea7a6cbf01c95393784f1157d Mon Sep 17 00:00:00 2001 From: Eric Landuyt <6954689+EricLanduyt@users.noreply.github.com> Date: Sun, 3 Nov 2019 11:48:41 +0100 Subject: [PATCH 02/10] sanctuary-type-classes ^11.0.0 --- package.json | 2 +- yarn.lock | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 48200ff..d314e6c 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "jsverify": "^0.8.3", "mocha": "^5.2.0", "sanctuary-style": "^2.0.0", - "sanctuary-type-classes": "^10.0.0", + "sanctuary-type-classes": "^11.0.0", "xyz": "3.0.x" } } diff --git a/yarn.lock b/yarn.lock index 484c70d..e4aa229 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2996,7 +2996,7 @@ sanctuary-style@^2.0.0: resolved "https://registry.yarnpkg.com/sanctuary-style/-/sanctuary-style-2.0.0.tgz#83d023a340641bcc1d27acee013c098b12075586" integrity sha512-5g3UnBDY3419ipokMa/PXY9DM7XVU7sUMq3RMHRKnbqS9KYKWYvysljb8/rHi+bWut5n1omWEQJEyKUHY+482w== -sanctuary-type-classes@10.0.0, sanctuary-type-classes@10.0.x, sanctuary-type-classes@^10.0.0: +sanctuary-type-classes@10.0.0, sanctuary-type-classes@10.0.x: version "10.0.0" resolved "https://registry.yarnpkg.com/sanctuary-type-classes/-/sanctuary-type-classes-10.0.0.tgz#25126f009348101dbe627c7b7efb7c6f63f792b1" integrity sha512-h5Q1VkW/CmVbmoWDf6HdsgJbx5gc3n6R5lRzzKRssYSkghmqEuAr+0ThJs/bqJK8aiQwh3N2PXP4ZppYEDlSdg== @@ -3010,6 +3010,13 @@ sanctuary-type-classes@9.0.0: dependencies: sanctuary-type-identifiers "1.0.x" +sanctuary-type-classes@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/sanctuary-type-classes/-/sanctuary-type-classes-11.0.0.tgz#f7f752a846aad057d894183a20169bc593ddb039" + integrity sha512-J9vfS19C9TSd0pIxz7dza0krxUGoo7LYdwQzkmO7zEsbzmPEwbB3HByLgN/zI+QYd0m08IdohAzYJSAd89Fdqg== + dependencies: + sanctuary-type-identifiers "2.0.1" + sanctuary-type-identifiers@1.0.x: version "1.0.0" resolved "https://registry.yarnpkg.com/sanctuary-type-identifiers/-/sanctuary-type-identifiers-1.0.0.tgz#e8f359f006cb5e624cfb8464603fc114608bde9f" From 4d5a14a6474d4ed673cc2fe582cae13c34608f36 Mon Sep 17 00:00:00 2001 From: Eric Landuyt <6954689+EricLanduyt@users.noreply.github.com> Date: Sun, 3 Nov 2019 11:51:29 +0100 Subject: [PATCH 03/10] sanctuary ^1.1.0 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index d314e6c..9ad9773 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "fantasy-land": "^3.5.0", "hm-parser": "^0.1.5", "mem": "^4.0.0", - "sanctuary": "^1.0.0", + "sanctuary": "^1.1.0", "sanctuary-def": "^0.19.0", "sanctuary-show": "^1.0.0" }, diff --git a/yarn.lock b/yarn.lock index e4aa229..f23c402 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3027,10 +3027,10 @@ sanctuary-type-identifiers@2.0.1, sanctuary-type-identifiers@2.0.x: resolved "https://registry.yarnpkg.com/sanctuary-type-identifiers/-/sanctuary-type-identifiers-2.0.1.tgz#fc524cf6dd92cebfcbb0dd9509eff193159a20ed" integrity sha1-/FJM9t2Szr/LsN2VCe/xkxWaIO0= -sanctuary@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/sanctuary/-/sanctuary-1.0.0.tgz#ecddfd453290b4e269fdc4bb8314e3c25febc79d" - integrity sha512-H+C80DadljM0gyWe5Y3R8bDIDW8MU8/XBg0h0V2zwusmljRAVrBQshd6XU3zFxk+lHj04e9xoUvBscRfl8vO8g== +sanctuary@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/sanctuary/-/sanctuary-1.1.0.tgz#b1e66dd0746377e89bfd1ec0916e010e3f4dc4d3" + integrity sha512-GnZoSJ0tlNneowz+shFYLd1+wQ0g9bR3TeBbDi0rwEdpspu6mQPxEghskJrGww2rBNjyPclEL5pzNC0oCUYHAQ== dependencies: sanctuary-def "0.19.0" sanctuary-either "1.1.0" From 8dbe2732d48ab745659c43316c45012dd2b320f1 Mon Sep 17 00:00:00 2001 From: Eric Landuyt <6954689+EricLanduyt@users.noreply.github.com> Date: Sun, 3 Nov 2019 15:36:13 +0100 Subject: [PATCH 04/10] sanctuary ^2.0.0, sanctuary-def ^0.20.0 --- package.json | 4 +-- src/signature.js | 10 +++--- test/def.spec.js | 22 ++++++------ test/signature.spec.js | 20 ++++++++--- yarn.lock | 82 +++++++++++++++++++++--------------------- 5 files changed, 77 insertions(+), 61 deletions(-) diff --git a/package.json b/package.json index 9ad9773..e41efb6 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,8 @@ "fantasy-land": "^3.5.0", "hm-parser": "^0.1.5", "mem": "^4.0.0", - "sanctuary": "^1.1.0", - "sanctuary-def": "^0.19.0", + "sanctuary": "^2.0.0", + "sanctuary-def": "^0.20.0", "sanctuary-show": "^1.0.0" }, "devDependencies": { diff --git a/src/signature.js b/src/signature.js index 4a1ef6a..83b989f 100644 --- a/src/signature.js +++ b/src/signature.js @@ -189,16 +189,18 @@ export const resolve = $ => { const fromUnaryType = t => $.UnaryType (t.name) (t.url) + (t.supertypes) (t._test) - (t.types.$1.extractor); + (t.extractors.$1); // fromBinaryType :: Type -> (Type -> Type -> Type) const fromBinaryType = t => $.BinaryType (t.name) (t.url) + (t.supertypes) (t._test) - (t.types.$1.extractor) - (t.types.$2.extractor); + (t.extractors.$1) + (t.extractors.$2); // constructType :: (Array Type) -> Type -> Type const constructType = argTypes => t => { @@ -217,7 +219,7 @@ export const resolve = $ => { }; // Helper Type to wipe out thunks - const Thunk = $.NullaryType ('hm-def/Thunk') ('') (S.K (false)); + const Thunk = $.NullaryType ('hm-def/Thunk') ('') ([]) (S.K (false)); // convertType :: SignatureEntry -> Reader (TypeMap Type) const convertType = memoize (entry => cond ([ diff --git a/test/def.spec.js b/test/def.spec.js index 030321a..a1cbb64 100644 --- a/test/def.spec.js +++ b/test/def.spec.js @@ -9,6 +9,7 @@ const hasProp = p => x => x[p] !== undefined; const $Map = $.BinaryType ('Map') ('someurl') + ([]) (S.is ($.Object)) (S.keys) (S.values); @@ -16,7 +17,8 @@ const $Map = $.BinaryType const $Wrapper = $.UnaryType ('Wrapper') ('someurl') - (S.allPass ([S.is ($.Object), hasProp ('value')])) + ([]) + (x => S.is ($.Object) (x) && S.isJust (S.get (S.complement (S.is ($.Undefined))) ('value') (x))) (S.pipe ([S.prop ('value'), S.of (Array)])); const def = create ({ @@ -66,7 +68,7 @@ describe ('def', () => { const cube = x => x * x * x; assert.deepEqual (foo (cube) ([1, 2, 3]), [1, 8, 27]); - assert.throws (() => foo (cube) ('im-not-an-unary-type'), 'Type-class constraint violation'); + assert.throws (() => foo (cube) ('im-not-an-unary-type'), 'The value at position 1 is not a member of ‘f a’'); }); it ('should work with type class constraints', () => { @@ -85,8 +87,8 @@ describe ('def', () => { (S.prop ('value')); assert.equal (foo ({value: 10}), 10); - assert.throws (() => foo ({}), 'The value at position 1 is not a member of ‘Wrapper Number’'); - assert.throws (() => foo (null), 'The value at position 1 is not a member of ‘Wrapper Number’'); + assert.throws (() => foo ({}), Error); // FIXME message 'The value at position 1 is not a member of ‘Wrapper Number’'); + assert.throws (() => foo (null), Error); // FIXME message 'The value at position 1 is not a member of ‘Wrapper Number’'); assert.throws (() => foo ({value: 'hello'}), 'The value at position 1 is not a member of ‘Number’'); const bar = def @@ -94,8 +96,8 @@ describe ('def', () => { (x => { x.value = x.value.toString (); return x; }); assert.deepEqual (bar ({value: 10}), {value: '10'}); - assert.throws (() => bar ({}), 'The value at position 1 is not a member of ‘Wrapper Number’'); - assert.throws (() => bar (null), 'The value at position 1 is not a member of ‘Wrapper Number’'); + assert.throws (() => bar ({}), Error); // FIXME message 'The value at position 1 is not a member of ‘Wrapper Number’'); + assert.throws (() => bar (null), Error); // FIXME message 'The value at position 1 is not a member of ‘Wrapper Number’'); assert.throws (() => bar ({value: 'hello'}), 'The value at position 1 is not a member of ‘Number’'); }); @@ -106,7 +108,7 @@ describe ('def', () => { assert.deepEqual (foo ({a: 5, b: 7}), {a: '5', b: '7'}); assert.throws (() => foo ({a: false}), 'The value at position 1 is not a member of ‘Number’'); - assert.throws (() => foo (null), 'The value at position 1 is not a member of ‘Map String Number’'); + assert.throws (() => foo (null), Error); // FIXME message 'The value at position 1 is not a member of ‘Map String Number’'); const bar = def ('bar :: Map String (Map String Number) -> Map String Boolean') @@ -117,15 +119,15 @@ describe ('def', () => { ]))); assert.deepEqual (bar ({a: {x: 0, y: 1}, b: {x: 1, y: 3}}), {a: true, b: false}); - assert.throws (() => bar ({a: false}), 'The value at position 1 is not a member of ‘Map String Number’'); - assert.throws (() => bar (null), 'The value at position 1 is not a member of ‘Map String (Map String Number)’'); +// assert.throws (() => bar ({a: false}), 'The value at position 1 is not a member of ‘Map String Number’'); // FIXME not thrown anymore ! + assert.throws (() => bar (null), Error); // FIXME message 'The value at position 1 is not a member of ‘Map String (Map String Number)’'); const buzz = def ('buzz :: Map a b -> Map a a') (S.map (x => x.toString ())); assert.deepEqual (buzz ({a: 1, b: 2}), {a: '1', b: '2'}); - assert.throws (() => buzz (null), 'The value at position 1 is not a member of ‘Map a b’'); + assert.throws (() => buzz (null), Error); // FIXME message 'The value at position 1 is not a member of ‘Map a b’'); }); it ('should work with higher order functions', () => { diff --git a/test/signature.spec.js b/test/signature.spec.js index 28b445f..d5e7934 100644 --- a/test/signature.spec.js +++ b/test/signature.spec.js @@ -6,6 +6,8 @@ import {resolve} from '../src/signature'; // assertSameType :: Type -> Type -> Undefined ! const assertSameType = actual => expected => { + return assert.isOk (S.equals (actual) (expected)) // FIXME directly replace assertTypePairs( S.zip (types) (..) ) by S.equals (types) (expecteds) +/* assert.strictEqual (actual.name, expected.name); assert.strictEqual (actual.type, expected.type); assert.deepEqual (actual.keys, expected.keys); @@ -13,6 +15,7 @@ const assertSameType = actual => expected => { expected.keys.forEach (key => { assertSameType (actual.types[key].type) (expected.types[key].type); }); +*/ }; const assertTypePairs = xs => xs.forEach @@ -59,14 +62,14 @@ describe ('Parameter types', () => { }); it ('should resolve user types', () => { - const Widget = $.NullaryType ('Widget') ('http://example.com/Widget') (S.K (true)); + const Widget = $.NullaryType ('Widget') ('http://example.com/Widget') ([]) (S.K (true)); const env = $.env.concat ([Widget]); const {types} = resolve ($) ([]) (env) ('foo :: Widget -> String'); assert.deepEqual (types, [Widget, $.String]); }); it ('should resolve namespaced user types', () => { - const Widget = $.NullaryType ('x/y/z/Widget') ('http://example.com/Widget') (S.K (true)); + const Widget = $.NullaryType ('x/y/z/Widget') ('http://example.com/Widget') ([]) (S.K (true)); const env = $.env.concat ([Widget]); const {types} = resolve ($) ([]) (env) ('foo :: Widget -> String'); assert.deepEqual (types, [Widget, $.String]); @@ -136,6 +139,7 @@ describe ('Parameter types', () => { const Maybe = $.UnaryType ('my-package/Maybe') ('http://example.com/my-package#Maybe') + ([]) (S.K (true)) (S.K ([])); @@ -147,11 +151,19 @@ describe ('Parameter types', () => { }); it ('should resolve eithers', () => { + const Either = $.BinaryType + ('my-package/Either') + ('http://example.com/my-package#Either') + ([]) + (x => x != null && x['@@type'] === 'my-package/Either') + (either => (either.isLeft ? [either.value] : [])) + (either => (either.isRight ? [either.value] : [])); + const env = $.env.concat ([ - S.EitherType ($.Unknown) ($.Unknown), + Either ($.Unknown) ($.Unknown), ]); const {types} = resolve ($) ([]) (env) ('foo :: Either String Number -> String'); - assertTypePairs (S.zip (types) ([S.EitherType ($.String) ($.Number), $.String])); + assertTypePairs (S.zip (types) ([Either ($.String) ($.Number), $.String])); }); it ('should resolve thunks', () => { diff --git a/yarn.lock b/yarn.lock index f23c402..1c843d7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2944,24 +2944,16 @@ safe-regex@^1.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sanctuary-def@0.19.0, sanctuary-def@^0.19.0: - version "0.19.0" - resolved "https://registry.yarnpkg.com/sanctuary-def/-/sanctuary-def-0.19.0.tgz#84dd038f723512168028654dd89563cbbf3a34af" - integrity sha512-1ZJX4LC3Kh4B9bnGGCN8qQS7GrHltLtibQnsaFqaoUpKIT4qCfUuCy/Beke352E948+lmquowyDfkMHtZ/0m3w== +sanctuary-def@0.20.0, sanctuary-def@^0.20.0: + version "0.20.0" + resolved "https://registry.yarnpkg.com/sanctuary-def/-/sanctuary-def-0.20.0.tgz#bcecc9a1469c025467ea31f0ec6228ed56962bb3" + integrity sha512-BjDwAq+4aHZhKyOR35oVfVkCOLfKMOVw6UqQfkzL/Ul5G290J0nITSmnM9fP6EaH2rV/0quR7wgoCgX5Um5YGg== dependencies: - sanctuary-either "1.0.x" + sanctuary-either "1.1.0" sanctuary-show "1.0.x" - sanctuary-type-classes "10.0.x" + sanctuary-type-classes "11.0.x" sanctuary-type-identifiers "2.0.x" -sanctuary-either@1.0.x: - version "1.0.0" - resolved "https://registry.yarnpkg.com/sanctuary-either/-/sanctuary-either-1.0.0.tgz#b6041e54c639700048be757ba4d6c026c2c2f67c" - integrity sha512-j4WAlwILU83wawXJQCSh5kVK27gxOykMuCfUfUOba/qUcFE+FxwHkt7lnHVYDjt7jG9SENe8bTQzPH/Zmhy3Ag== - dependencies: - sanctuary-show "1.0.x" - sanctuary-type-classes "9.0.0" - sanctuary-either@1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/sanctuary-either/-/sanctuary-either-1.1.0.tgz#9d45b344d870c16fc72f574feec1744dc50f4e1f" @@ -2970,21 +2962,29 @@ sanctuary-either@1.1.0: sanctuary-show "1.0.x" sanctuary-type-classes "10.0.0" -sanctuary-maybe@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/sanctuary-maybe/-/sanctuary-maybe-1.1.0.tgz#b4b6807d949dc56fbc30834aebb925de1a05cddf" - integrity sha512-MwHsfddXxfn7Ywy9hiRIA/+lbJBUKeKI/cSHwTKkbLkelSBhSpBgZZI4giSZRwbP9OpxOpbkS+rFc//+HCVwdw== +sanctuary-either@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/sanctuary-either/-/sanctuary-either-1.2.0.tgz#3126196a2067ea4a9b1de6b6c4c045504059a44b" + integrity sha512-CFUK0OOGAe+t+Ct4yVLfkJPABIkplCvIgCOFIJZ+lIMNAeJrSaVacrZVqRErt4YKzDs42ZXecAEpoDL8rRAfsQ== dependencies: sanctuary-show "1.0.x" - sanctuary-type-classes "10.0.0" + sanctuary-type-classes "11.0.0" -sanctuary-pair@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/sanctuary-pair/-/sanctuary-pair-1.1.0.tgz#5a0d3d54ba2a1ebcd3a0bf3a2bc7c86c085a36ed" - integrity sha512-lr+lTHZCzKD3PAS8YHB0YhVLsKIRIzoeIg5SBWYquXgabVdVShOT+J+7E3cg4v+FOpgN1HWguYQcbJczCSEVyQ== +sanctuary-maybe@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/sanctuary-maybe/-/sanctuary-maybe-1.2.0.tgz#e994825d62f6d5a3c60771e859261b08c517acc5" + integrity sha512-SH4dkyrruJe84/q8YMjc6kWyGbqPH6clM6yfJ/iosQZm+bGK2XPgcPs1yDN0U0zm1JzJ563zdwn64W+aMw5CDw== dependencies: sanctuary-show "1.0.x" - sanctuary-type-classes "10.0.0" + sanctuary-type-classes "11.0.0" + +sanctuary-pair@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/sanctuary-pair/-/sanctuary-pair-1.2.0.tgz#2538dbdac011594fd601ca1112e83cb5083bc865" + integrity sha512-bPu+uFxFE2RP3hLlC6SRMsm4A2aEwHkDwHWuvGzHxYaclGnHCrHy0ykRTuR0Pgqy/ZlWl6zy+8Tek3jME3du6A== + dependencies: + sanctuary-show "1.0.x" + sanctuary-type-classes "11.0.0" sanctuary-show@1.0.0, sanctuary-show@1.0.x, sanctuary-show@^1.0.0: version "1.0.0" @@ -2996,13 +2996,20 @@ sanctuary-style@^2.0.0: resolved "https://registry.yarnpkg.com/sanctuary-style/-/sanctuary-style-2.0.0.tgz#83d023a340641bcc1d27acee013c098b12075586" integrity sha512-5g3UnBDY3419ipokMa/PXY9DM7XVU7sUMq3RMHRKnbqS9KYKWYvysljb8/rHi+bWut5n1omWEQJEyKUHY+482w== -sanctuary-type-classes@10.0.0, sanctuary-type-classes@10.0.x: +sanctuary-type-classes@10.0.0: version "10.0.0" resolved "https://registry.yarnpkg.com/sanctuary-type-classes/-/sanctuary-type-classes-10.0.0.tgz#25126f009348101dbe627c7b7efb7c6f63f792b1" integrity sha512-h5Q1VkW/CmVbmoWDf6HdsgJbx5gc3n6R5lRzzKRssYSkghmqEuAr+0ThJs/bqJK8aiQwh3N2PXP4ZppYEDlSdg== dependencies: sanctuary-type-identifiers "2.0.1" +sanctuary-type-classes@11.0.0, sanctuary-type-classes@11.0.x, sanctuary-type-classes@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/sanctuary-type-classes/-/sanctuary-type-classes-11.0.0.tgz#f7f752a846aad057d894183a20169bc593ddb039" + integrity sha512-J9vfS19C9TSd0pIxz7dza0krxUGoo7LYdwQzkmO7zEsbzmPEwbB3HByLgN/zI+QYd0m08IdohAzYJSAd89Fdqg== + dependencies: + sanctuary-type-identifiers "2.0.1" + sanctuary-type-classes@9.0.0: version "9.0.0" resolved "https://registry.yarnpkg.com/sanctuary-type-classes/-/sanctuary-type-classes-9.0.0.tgz#b44741ca67fa650cbd314e1ad318d730ce1309a4" @@ -3010,13 +3017,6 @@ sanctuary-type-classes@9.0.0: dependencies: sanctuary-type-identifiers "1.0.x" -sanctuary-type-classes@^11.0.0: - version "11.0.0" - resolved "https://registry.yarnpkg.com/sanctuary-type-classes/-/sanctuary-type-classes-11.0.0.tgz#f7f752a846aad057d894183a20169bc593ddb039" - integrity sha512-J9vfS19C9TSd0pIxz7dza0krxUGoo7LYdwQzkmO7zEsbzmPEwbB3HByLgN/zI+QYd0m08IdohAzYJSAd89Fdqg== - dependencies: - sanctuary-type-identifiers "2.0.1" - sanctuary-type-identifiers@1.0.x: version "1.0.0" resolved "https://registry.yarnpkg.com/sanctuary-type-identifiers/-/sanctuary-type-identifiers-1.0.0.tgz#e8f359f006cb5e624cfb8464603fc114608bde9f" @@ -3027,17 +3027,17 @@ sanctuary-type-identifiers@2.0.1, sanctuary-type-identifiers@2.0.x: resolved "https://registry.yarnpkg.com/sanctuary-type-identifiers/-/sanctuary-type-identifiers-2.0.1.tgz#fc524cf6dd92cebfcbb0dd9509eff193159a20ed" integrity sha1-/FJM9t2Szr/LsN2VCe/xkxWaIO0= -sanctuary@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/sanctuary/-/sanctuary-1.1.0.tgz#b1e66dd0746377e89bfd1ec0916e010e3f4dc4d3" - integrity sha512-GnZoSJ0tlNneowz+shFYLd1+wQ0g9bR3TeBbDi0rwEdpspu6mQPxEghskJrGww2rBNjyPclEL5pzNC0oCUYHAQ== +sanctuary@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/sanctuary/-/sanctuary-2.0.0.tgz#71c2e8af7cfe034ece2c7a932232ba917a03dd0f" + integrity sha512-FYjhCKBS7meY4Lrjsx7CL+2+qnCsgUqJUvFYoLU7ahiGM8LqTOkhAtdGZGG+bhCIP0iCEfDWRq35pQJTfmtFrg== dependencies: - sanctuary-def "0.19.0" - sanctuary-either "1.1.0" - sanctuary-maybe "1.1.0" - sanctuary-pair "1.1.0" + sanctuary-def "0.20.0" + sanctuary-either "1.2.0" + sanctuary-maybe "1.2.0" + sanctuary-pair "1.2.0" sanctuary-show "1.0.0" - sanctuary-type-classes "10.0.0" + sanctuary-type-classes "11.0.0" sanctuary-type-identifiers "2.0.1" sax@^1.2.4: From 40ac5926648317a81c03d043d78664e2c0cd64e9 Mon Sep 17 00:00:00 2001 From: Eric Landuyt <6954689+EricLanduyt@users.noreply.github.com> Date: Sun, 3 Nov 2019 16:23:43 +0100 Subject: [PATCH 05/10] Wrapper UnaryType has much cleaner predicate (suggested by David Chambers) --- test/def.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/def.spec.js b/test/def.spec.js index a1cbb64..9a03d8d 100644 --- a/test/def.spec.js +++ b/test/def.spec.js @@ -17,8 +17,8 @@ const $Map = $.BinaryType const $Wrapper = $.UnaryType ('Wrapper') ('someurl') - ([]) - (x => S.is ($.Object) (x) && S.isJust (S.get (S.complement (S.is ($.Undefined))) ('value') (x))) + ([$.Object]) + (x => 'value' in x) (S.pipe ([S.prop ('value'), S.of (Array)])); const def = create ({ From bd26594f6ab706d6afb384e981f5ed8e047b1154 Mon Sep 17 00:00:00 2001 From: Eric Landuyt <6954689+EricLanduyt@users.noreply.github.com> Date: Sun, 3 Nov 2019 16:34:58 +0100 Subject: [PATCH 06/10] fixed wrong asserts because change in predicate's first argument (David Chambers, "We need t._test ([]) rather than t._test because _test now takes an environment as its first argument. We were only partially applying the predicate, which meant we were always getting back a function which was then coerced to true.") --- src/signature.js | 4 ++-- test/def.spec.js | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/signature.js b/src/signature.js index 83b989f..cf06463 100644 --- a/src/signature.js +++ b/src/signature.js @@ -190,7 +190,7 @@ export const resolve = $ => { (t.name) (t.url) (t.supertypes) - (t._test) + (t._test ([])) (t.extractors.$1); // fromBinaryType :: Type -> (Type -> Type -> Type) @@ -198,7 +198,7 @@ export const resolve = $ => { (t.name) (t.url) (t.supertypes) - (t._test) + (t._test ([])) (t.extractors.$1) (t.extractors.$2); diff --git a/test/def.spec.js b/test/def.spec.js index 9a03d8d..245e4cf 100644 --- a/test/def.spec.js +++ b/test/def.spec.js @@ -87,8 +87,8 @@ describe ('def', () => { (S.prop ('value')); assert.equal (foo ({value: 10}), 10); - assert.throws (() => foo ({}), Error); // FIXME message 'The value at position 1 is not a member of ‘Wrapper Number’'); - assert.throws (() => foo (null), Error); // FIXME message 'The value at position 1 is not a member of ‘Wrapper Number’'); + assert.throws (() => foo ({}), 'The value at position 1 is not a member of ‘Wrapper Number’'); + assert.throws (() => foo (null), 'The value at position 1 is not a member of ‘Wrapper Number’'); assert.throws (() => foo ({value: 'hello'}), 'The value at position 1 is not a member of ‘Number’'); const bar = def @@ -96,8 +96,8 @@ describe ('def', () => { (x => { x.value = x.value.toString (); return x; }); assert.deepEqual (bar ({value: 10}), {value: '10'}); - assert.throws (() => bar ({}), Error); // FIXME message 'The value at position 1 is not a member of ‘Wrapper Number’'); - assert.throws (() => bar (null), Error); // FIXME message 'The value at position 1 is not a member of ‘Wrapper Number’'); + assert.throws (() => bar ({}), 'The value at position 1 is not a member of ‘Wrapper Number’'); + assert.throws (() => bar (null), 'The value at position 1 is not a member of ‘Wrapper Number’'); assert.throws (() => bar ({value: 'hello'}), 'The value at position 1 is not a member of ‘Number’'); }); @@ -108,7 +108,7 @@ describe ('def', () => { assert.deepEqual (foo ({a: 5, b: 7}), {a: '5', b: '7'}); assert.throws (() => foo ({a: false}), 'The value at position 1 is not a member of ‘Number’'); - assert.throws (() => foo (null), Error); // FIXME message 'The value at position 1 is not a member of ‘Map String Number’'); + assert.throws (() => foo (null), 'The value at position 1 is not a member of ‘Map String Number’'); const bar = def ('bar :: Map String (Map String Number) -> Map String Boolean') @@ -119,15 +119,15 @@ describe ('def', () => { ]))); assert.deepEqual (bar ({a: {x: 0, y: 1}, b: {x: 1, y: 3}}), {a: true, b: false}); -// assert.throws (() => bar ({a: false}), 'The value at position 1 is not a member of ‘Map String Number’'); // FIXME not thrown anymore ! - assert.throws (() => bar (null), Error); // FIXME message 'The value at position 1 is not a member of ‘Map String (Map String Number)’'); + assert.throws (() => bar ({a: false}), 'The value at position 1 is not a member of ‘Map String Number’'); + assert.throws (() => bar (null), 'The value at position 1 is not a member of ‘Map String (Map String Number)’'); const buzz = def ('buzz :: Map a b -> Map a a') (S.map (x => x.toString ())); assert.deepEqual (buzz ({a: 1, b: 2}), {a: '1', b: '2'}); - assert.throws (() => buzz (null), Error); // FIXME message 'The value at position 1 is not a member of ‘Map a b’'); + assert.throws (() => buzz (null), 'The value at position 1 is not a member of ‘Map a b’'); }); it ('should work with higher order functions', () => { From 1e4449ef0e5c2ca9ac591e21d2a3ad03a504fdab Mon Sep 17 00:00:00 2001 From: Eric Landuyt <6954689+EricLanduyt@users.noreply.github.com> Date: Tue, 5 Nov 2019 22:36:02 +0100 Subject: [PATCH 07/10] output diff of actual/expected in case of assert failure --- test/signature.spec.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/test/signature.spec.js b/test/signature.spec.js index d5e7934..db39aef 100644 --- a/test/signature.spec.js +++ b/test/signature.spec.js @@ -3,19 +3,14 @@ import $ from 'sanctuary-def'; import Z from 'sanctuary-type-classes'; import {assert} from 'chai'; import {resolve} from '../src/signature'; +import show from 'sanctuary-show'; // assertSameType :: Type -> Type -> Undefined ! const assertSameType = actual => expected => { - return assert.isOk (S.equals (actual) (expected)) // FIXME directly replace assertTypePairs( S.zip (types) (..) ) by S.equals (types) (expecteds) -/* - assert.strictEqual (actual.name, expected.name); - assert.strictEqual (actual.type, expected.type); - assert.deepEqual (actual.keys, expected.keys); - assert.deepEqual (actual.url, expected.url); - expected.keys.forEach (key => { - assertSameType (actual.types[key].type) (expected.types[key].type); - }); -*/ + if (!(S.equals (actual) (expected))) { // Type is Setoid providing equals() + assert.equal (show (actual), show (expected), "S.equals"); // assert.equal() because assert.isOk() does not diff actual/expected + assert.fail(); // final failure in the hypothetical case that show() would return same strings for different types + } }; const assertTypePairs = xs => xs.forEach From 086d980b567774d68cf8bcd8003d7efb2b25d009 Mon Sep 17 00:00:00 2001 From: Eric Landuyt <6954689+EricLanduyt@users.noreply.github.com> Date: Tue, 5 Nov 2019 22:54:03 +0100 Subject: [PATCH 08/10] fixed possible wrong asserts because S.zip() stops on shorter array --- test/signature.spec.js | 43 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/test/signature.spec.js b/test/signature.spec.js index db39aef..afb7881 100644 --- a/test/signature.spec.js +++ b/test/signature.spec.js @@ -5,19 +5,14 @@ import {assert} from 'chai'; import {resolve} from '../src/signature'; import show from 'sanctuary-show'; -// assertSameType :: Type -> Type -> Undefined ! -const assertSameType = actual => expected => { - if (!(S.equals (actual) (expected))) { // Type is Setoid providing equals() +// assertSameTypes :: [Type] -> [Type] -> Undefined ! +const assertSameTypes = actual => expected => { + if (!(S.equals (actual) (expected))) { // Array and Type are both Setoid providing equals() assert.equal (show (actual), show (expected), "S.equals"); // assert.equal() because assert.isOk() does not diff actual/expected - assert.fail(); // final failure in the hypothetical case that show() would return same strings for different types + assert.fail (); // final failure in the hypothetical case that show() would return same strings for different types } }; -const assertTypePairs = xs => xs.forEach - (pair => assertSameType - (S.fst (pair)) - (S.snd (pair))); - describe ('Function name', () => { it ('should be extracted', () => { const {name} = resolve ($) ([]) ($.env) ('foo :: Number -> Number'); @@ -72,27 +67,22 @@ describe ('Parameter types', () => { it ('should resolve lists', () => { const {types} = resolve ($) ([]) ($.env) ('foo :: [Number] -> [String]'); - const expecteds = [$.Array ($.Number), $.Array ($.String)]; - - const lists = S.zip (types) (expecteds); - assertTypePairs (lists); + assertSameTypes (types) ([$.Array ($.Number), $.Array ($.String)]); }); it ('should resolve functions', () => { const {types} = resolve ($) ([]) ($.env) ('foo :: Number -> (Number -> Number)'); - const lists = S.zip (types) ([$.Number, $.Function ([$.Number, $.Number])]); - assertTypePairs (lists); + assertSameTypes (types) ([$.Number, $.Function ([$.Number, $.Number])]); }); it ('should resolve functions that return multi-arity functions', () => { const {types} = resolve ($) ([]) ($.env) ('foo :: Number -> (Number -> Number -> Number)'); - const lists = S.zip (types) ([$.Number, $.Function ([$.Number, $.Function ([$.Number, $.Number])])]); - assertTypePairs (lists); + assertSameTypes (types) ([$.Number, $.Function ([$.Number, $.Function ([$.Number, $.Number])])]); }); it ('should resolve higher-order functions that take multi-arity functions', () => { const {types} = resolve ($) ([]) ($.env) ('foo :: (Number -> Number -> Number) -> Number'); - const lists = S.zip (types) ([ + const expecteds = [ $.Function ([ $.Number, $.Function ([ @@ -101,14 +91,13 @@ describe ('Parameter types', () => { ]), ]), $.Number, - ]); - assertTypePairs (lists); + ]; + assertSameTypes (types) (expecteds); }); it ('should resolve unary types', () => { const {types} = resolve ($) ([]) ($.env) ('foo :: Number -> StrMap Number'); - const lists = S.zip (types) ([$.Number, $.StrMap ($.Number)]); - assertTypePairs (lists); + assertSameTypes (types) ([$.Number, $.StrMap ($.Number)]); }); it ('should bark on wrong number of arguments', () => { @@ -142,7 +131,7 @@ describe ('Parameter types', () => { Maybe ($.Unknown), ]); const {types} = resolve ($) ([]) (env) ('foo :: Maybe String -> String'); - assertTypePairs (S.zip (types) ([Maybe ($.String), $.String])); + assertSameTypes (types) ([Maybe ($.String), $.String]); }); it ('should resolve eithers', () => { @@ -158,17 +147,17 @@ describe ('Parameter types', () => { Either ($.Unknown) ($.Unknown), ]); const {types} = resolve ($) ([]) (env) ('foo :: Either String Number -> String'); - assertTypePairs (S.zip (types) ([Either ($.String) ($.Number), $.String])); + assertSameTypes (types) ([Either ($.String) ($.Number), $.String]); }); it ('should resolve thunks', () => { const {types} = resolve ($) ([]) ($.env) ('foo :: () -> Number'); - assertTypePairs (S.zip (types) ([$.Number])); + assertSameTypes (types) ([$.Number]); }); it ('should resolve records', () => { const {types} = resolve ($) ([]) ($.env) ('foo :: { value :: Number } -> Number'); - assertTypePairs (S.zip (types) ([$.RecordType ({value: $.Number}), $.Number])); + assertSameTypes (types) ([$.RecordType ({value: $.Number}), $.Number]); }); it ('should resolve constraints', () => { @@ -177,6 +166,6 @@ describe ('Parameter types', () => { const f = $.UnaryTypeVariable ('f'); const tcs = [Z.Functor]; const {types} = resolve ($) (tcs) ($.env) ('foo :: Functor f => (a -> b) -> f a -> f b'); - assertTypePairs (S.zip (types) ([$.Function ([a, b]), f (a), f (b)])); + assertSameTypes (types) ([$.Function ([a, b]), f (a), f (b)]); }); }); From b6f701e62ccf6c9822fc99d746e4c0be9ae5c019 Mon Sep 17 00:00:00 2001 From: Eric Landuyt <6954689+EricLanduyt@users.noreply.github.com> Date: Tue, 5 Nov 2019 22:57:57 +0100 Subject: [PATCH 09/10] make linter happy --- test/def.spec.js | 2 -- test/signature.spec.js | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/test/def.spec.js b/test/def.spec.js index 245e4cf..944c441 100644 --- a/test/def.spec.js +++ b/test/def.spec.js @@ -4,8 +4,6 @@ import Z from 'sanctuary-type-classes'; import {assert} from 'chai'; import {create} from '../src/index'; -const hasProp = p => x => x[p] !== undefined; - const $Map = $.BinaryType ('Map') ('someurl') diff --git a/test/signature.spec.js b/test/signature.spec.js index afb7881..727106a 100644 --- a/test/signature.spec.js +++ b/test/signature.spec.js @@ -1,14 +1,14 @@ import S from 'sanctuary'; import $ from 'sanctuary-def'; import Z from 'sanctuary-type-classes'; +import show from 'sanctuary-show'; import {assert} from 'chai'; import {resolve} from '../src/signature'; -import show from 'sanctuary-show'; // assertSameTypes :: [Type] -> [Type] -> Undefined ! const assertSameTypes = actual => expected => { if (!(S.equals (actual) (expected))) { // Array and Type are both Setoid providing equals() - assert.equal (show (actual), show (expected), "S.equals"); // assert.equal() because assert.isOk() does not diff actual/expected + assert.equal (show (actual), show (expected), 'S.equals'); // assert.equal() because assert.isOk() does not diff actual/expected assert.fail (); // final failure in the hypothetical case that show() would return same strings for different types } }; From 3a090e45d51d8b94b76ae3881fd53122de4e3cd2 Mon Sep 17 00:00:00 2001 From: Eric Landuyt <6954689+EricLanduyt@users.noreply.github.com> Date: Tue, 5 Nov 2019 23:04:05 +0100 Subject: [PATCH 10/10] sanctuary ^2.0.1, sanctuary-def ^0.20.1 --- package.json | 4 ++-- yarn.lock | 35 ++++++++++------------------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index e41efb6..6fdaa0f 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,8 @@ "fantasy-land": "^3.5.0", "hm-parser": "^0.1.5", "mem": "^4.0.0", - "sanctuary": "^2.0.0", - "sanctuary-def": "^0.20.0", + "sanctuary": "^2.0.1", + "sanctuary-def": "^0.20.1", "sanctuary-show": "^1.0.0" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 1c843d7..617731f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2944,24 +2944,16 @@ safe-regex@^1.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sanctuary-def@0.20.0, sanctuary-def@^0.20.0: - version "0.20.0" - resolved "https://registry.yarnpkg.com/sanctuary-def/-/sanctuary-def-0.20.0.tgz#bcecc9a1469c025467ea31f0ec6228ed56962bb3" - integrity sha512-BjDwAq+4aHZhKyOR35oVfVkCOLfKMOVw6UqQfkzL/Ul5G290J0nITSmnM9fP6EaH2rV/0quR7wgoCgX5Um5YGg== +sanctuary-def@0.20.1, sanctuary-def@^0.20.1: + version "0.20.1" + resolved "https://registry.yarnpkg.com/sanctuary-def/-/sanctuary-def-0.20.1.tgz#172f70a694a0ae6d3944c95cda6a18744c4eeac7" + integrity sha512-WdOg5uDpqvplADyUb7pyDMNaT73TUzsE7VdKnZsEz6CwsNh46NSQAWZXM0i6IiqItnDtILkL5RGd4SGAvmjxLw== dependencies: - sanctuary-either "1.1.0" + sanctuary-either "1.2.0" sanctuary-show "1.0.x" sanctuary-type-classes "11.0.x" sanctuary-type-identifiers "2.0.x" -sanctuary-either@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/sanctuary-either/-/sanctuary-either-1.1.0.tgz#9d45b344d870c16fc72f574feec1744dc50f4e1f" - integrity sha512-tQewdQTPKzuJGahV5iuILJM96I+AfIFn3vpi0s2FhHYENbRqO4JeFSWLNT1mJ9SupSJBopgWefWeUjq/ZKfdtg== - dependencies: - sanctuary-show "1.0.x" - sanctuary-type-classes "10.0.0" - sanctuary-either@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/sanctuary-either/-/sanctuary-either-1.2.0.tgz#3126196a2067ea4a9b1de6b6c4c045504059a44b" @@ -2996,13 +2988,6 @@ sanctuary-style@^2.0.0: resolved "https://registry.yarnpkg.com/sanctuary-style/-/sanctuary-style-2.0.0.tgz#83d023a340641bcc1d27acee013c098b12075586" integrity sha512-5g3UnBDY3419ipokMa/PXY9DM7XVU7sUMq3RMHRKnbqS9KYKWYvysljb8/rHi+bWut5n1omWEQJEyKUHY+482w== -sanctuary-type-classes@10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/sanctuary-type-classes/-/sanctuary-type-classes-10.0.0.tgz#25126f009348101dbe627c7b7efb7c6f63f792b1" - integrity sha512-h5Q1VkW/CmVbmoWDf6HdsgJbx5gc3n6R5lRzzKRssYSkghmqEuAr+0ThJs/bqJK8aiQwh3N2PXP4ZppYEDlSdg== - dependencies: - sanctuary-type-identifiers "2.0.1" - sanctuary-type-classes@11.0.0, sanctuary-type-classes@11.0.x, sanctuary-type-classes@^11.0.0: version "11.0.0" resolved "https://registry.yarnpkg.com/sanctuary-type-classes/-/sanctuary-type-classes-11.0.0.tgz#f7f752a846aad057d894183a20169bc593ddb039" @@ -3027,12 +3012,12 @@ sanctuary-type-identifiers@2.0.1, sanctuary-type-identifiers@2.0.x: resolved "https://registry.yarnpkg.com/sanctuary-type-identifiers/-/sanctuary-type-identifiers-2.0.1.tgz#fc524cf6dd92cebfcbb0dd9509eff193159a20ed" integrity sha1-/FJM9t2Szr/LsN2VCe/xkxWaIO0= -sanctuary@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/sanctuary/-/sanctuary-2.0.0.tgz#71c2e8af7cfe034ece2c7a932232ba917a03dd0f" - integrity sha512-FYjhCKBS7meY4Lrjsx7CL+2+qnCsgUqJUvFYoLU7ahiGM8LqTOkhAtdGZGG+bhCIP0iCEfDWRq35pQJTfmtFrg== +sanctuary@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/sanctuary/-/sanctuary-2.0.1.tgz#cf19548bb8df2f52c9367faf8f7a7a4cf52af0ee" + integrity sha512-CQWjFRzSYrq8g16RCdfV4v1iJwyRRw3dhLizA/rKkKSu1L+5tTlBjQuZl25mKSd4S5oLdVTIJ1RlVktvns9R9g== dependencies: - sanctuary-def "0.20.0" + sanctuary-def "0.20.1" sanctuary-either "1.2.0" sanctuary-maybe "1.2.0" sanctuary-pair "1.2.0"