Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sanctuary-type-identifiers@3.0.0 #285

Merged
merged 1 commit into from
Jan 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,10 @@
}

var Type$prototype = {
'constructor': {'@@type': 'sanctuary-def/Type@1'},
'@@type': 'sanctuary-def/Type@1',
'@@show': function() {
return this.format (I, K (I));
},
'validate': function(env) {
var test2 = _test (env);
var type = this;
Expand Down Expand Up @@ -408,9 +411,6 @@
Z.equals (this.keys, other.keys) &&
Z.equals (this.types, other.types)
);
},
'@@show': function() {
return this.format (I, K (I));
}
};

Expand Down Expand Up @@ -1604,30 +1604,30 @@
//. const show = require ('sanctuary-show');
//. const type = require ('sanctuary-type-identifiers');
//.
//. // MaybeTypeRep :: TypeRep Maybe
//. const MaybeTypeRep = {'@@type': 'my-package/Maybe'};
//. // maybeTypeIdent :: String
//. const maybeTypeIdent = 'my-package/Maybe';
//.
//. // Maybe :: Type -> Type
//. const Maybe = $.UnaryType
//. ('Maybe')
//. ('http://example.com/my-package#Maybe')
//. ([])
//. (x => type (x) === MaybeTypeRep['@@type'])
//. (x => type (x) === maybeTypeIdent)
//. (maybe => maybe.isJust ? [maybe.value] : []);
//.
//. // Nothing :: Maybe a
//. const Nothing = {
//. 'constructor': MaybeTypeRep,
//. 'isJust': false,
//. 'isNothing': true,
//. '@@type': maybeTypeIdent,
//. '@@show': () => 'Nothing',
//. };
//.
//. // Just :: a -> Maybe a
//. const Just = x => ({
//. 'constructor': MaybeTypeRep,
//. 'isJust': true,
//. 'isNothing': false,
//. '@@type': maybeTypeIdent,
//. '@@show': () => `Just (${show (x)})`,
//. 'value': x,
//. });
Expand Down Expand Up @@ -1720,15 +1720,15 @@
//. ```javascript
//. const type = require ('sanctuary-type-identifiers');
//.
//. // PairTypeRep :: TypeRep Pair
//. const PairTypeRep = {'@@type': 'my-package/Pair'};
//. // pairTypeIdent :: String
//. const pairTypeIdent = 'my-package/Pair';
//.
//. // $Pair :: Type -> Type -> Type
//. const $Pair = $.BinaryType
//. ('Pair')
//. ('http://example.com/my-package#Pair')
//. ([])
//. (x => type (x) === PairTypeRep['@@type'])
//. (x => type (x) === pairTypeIdent)
//. (({fst}) => [fst])
//. (({snd}) => [snd]);
//.
Expand All @@ -1738,9 +1738,9 @@
//. ({})
//. ([a, b, $Pair (a) (b)])
//. (fst => snd => ({
//. 'constructor': PairTypeRep,
//. 'fst': fst,
//. 'snd': snd,
//. '@@type': pairTypeIdent,
//. '@@show': () => `Pair (${show (fst)}) (${show (snd)})`,
//. }));
//.
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
"test": "npm run lint && sanctuary-test && npm run doctest"
},
"dependencies": {
"sanctuary-either": "1.2.0",
"sanctuary-either": "2.0.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"sanctuary-show": "2.0.0",
"sanctuary-type-classes": "11.0.x",
"sanctuary-type-identifiers": "2.0.x"
"sanctuary-type-classes": "12.0.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"sanctuary-type-identifiers": "3.0.0"
},
"devDependencies": {
"sanctuary-descending": "1.2.0",
"sanctuary-identity": "1.2.0",
"sanctuary-maybe": "1.2.0",
"sanctuary-pair": "1.2.0",
"sanctuary-descending": "2.0.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"sanctuary-identity": "2.0.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"sanctuary-maybe": "2.0.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"sanctuary-pair": "2.0.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"sanctuary-scripts": "4.0.x"
},
"files": [
Expand Down
7 changes: 2 additions & 5 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1431,13 +1431,10 @@ Since there is no type of which all the above values are members, the type-varia
eq ($.AnyFunction.url) (`https://github.com/sanctuary-js/sanctuary-def/tree/v${version}#Function`);
eq ($.AnyFunction.supertypes) ([]);

function Identity(x) { this.value = x; }
Identity['@@type'] = 'my-package/Identity';

const isAnyFunction = $.test ([]) ($.AnyFunction);
eq (isAnyFunction (null)) (false);
eq (isAnyFunction (Math.abs)) (true);
eq (isAnyFunction (Identity)) (true);
eq (isAnyFunction (function Identity(x) { this.value = x; })) (true);
eq (isAnyFunction (function* (x) { return x; })) (true);
});

Expand Down Expand Up @@ -3084,8 +3081,8 @@ See https://github.com/sanctuary-js/sanctuary-type-classes/tree/v${Z$version}#Al
test ('supports unary type variables', () => {
// Box :: a -> Box a
const Box = x => ({
'constructor': {'@@type': 'my-package/Box@1'},
'value': x,
'@@type': 'my-package/Box@1',
'@@show': () => 'Box (' + show (x) + ')',
});

Expand Down