Skip to content

Commit

Permalink
Merge pull request #125 from sanctuary-js/davidchambers/types
Browse files Browse the repository at this point in the history
types: expose Type and TypeClass
  • Loading branch information
davidchambers authored Mar 13, 2017
2 parents 6b44895 + 1b5a3e3 commit ac5b9df
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 21 deletions.
25 changes: 11 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,17 @@
//. Type comprising every primitive String value.
var String_ = NullaryTypeWithUrl('String', typeofEq('string'));

//# Type :: Type
//.
//. Type comprising every `Type` value.
var Type = NullaryTypeWithUrl('Type', typeEq('sanctuary-def/Type'));

//# TypeClass :: Type
//.
//. Type comprising every [`TypeClass`][] value.
var TypeClass =
NullaryTypeWithUrl('TypeClass', typeEq('sanctuary-type-classes/TypeClass'));

//# Undefined :: Type
//.
//. Type whose sole member is `undefined`.
Expand Down Expand Up @@ -781,20 +792,6 @@
Undefined
];

// Type :: Type
var Type = NullaryType(
'sanctuary-def/Type',
'',
typeEq('sanctuary-def/Type')
);

// TypeClass :: Type
var TypeClass = NullaryType(
'sanctuary-type-classes/TypeClass',
'',
typeEq('sanctuary-type-classes/TypeClass')
);

// Unchecked :: String -> Type
function Unchecked(s) { return NullaryType(s, '', K(true)); }

Expand Down
28 changes: 21 additions & 7 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ describe('def', function() {
'\n' +
'1) 1 :: Number\n' +
'\n' +
'The value at position 1 is not a member of ‘Type’.\n');
'The value at position 1 is not a member of ‘Type’.\n' +
'\n' +
'See https://github.com/sanctuary-js/sanctuary-def/tree/v' + version + '#Type for information about the Type type.\n');

throws(function() { def('', {}, [], null); },
TypeError,
Expand Down Expand Up @@ -1228,7 +1230,9 @@ describe('def', function() {
'\n' +
'1) /XXX/ :: RegExp\n' +
'\n' +
'The value at position 1 is not a member of ‘Type’.\n');
'The value at position 1 is not a member of ‘Type’.\n' +
'\n' +
'See https://github.com/sanctuary-js/sanctuary-def/tree/v' + version + '#Type for information about the Type type.\n');

// Foo :: Type
var Foo = $.RecordType({x: a, y: a});
Expand Down Expand Up @@ -1268,7 +1272,9 @@ describe('def', function() {
'\n' +
'1) null :: Null\n' +
'\n' +
'The value at position 1 is not a member of ‘Type’.\n');
'The value at position 1 is not a member of ‘Type’.\n' +
'\n' +
'See https://github.com/sanctuary-js/sanctuary-def/tree/v' + version + '#Type for information about the Type type.\n');

// toUpper :: Nullable String -> Nullable String
var toUpper =
Expand Down Expand Up @@ -2935,7 +2941,9 @@ describe('UnaryType', function() {
'\n' +
'1) {"x": Number, "y": Number} :: Object, StrMap ???\n' +
'\n' +
'The value at position 1 is not a member of ‘Type’.\n');
'The value at position 1 is not a member of ‘Type’.\n' +
'\n' +
'See https://github.com/sanctuary-js/sanctuary-def/tree/v' + version + '#Type for information about the Type type.\n');
});

});
Expand All @@ -2959,7 +2967,9 @@ describe('BinaryType', function() {
'\n' +
'1) {"x": Number, "y": Number} :: Object, StrMap ???\n' +
'\n' +
'The value at position 1 is not a member of ‘Type’.\n');
'The value at position 1 is not a member of ‘Type’.\n' +
'\n' +
'See https://github.com/sanctuary-js/sanctuary-def/tree/v' + version + '#Type for information about the Type type.\n');
});

});
Expand Down Expand Up @@ -3000,7 +3010,9 @@ describe('UnaryTypeVariable', function() {
'\n' +
'1) function Number() { [native code] } :: Function\n' +
'\n' +
'The value at position 1 is not a member of ‘Type’.\n');
'The value at position 1 is not a member of ‘Type’.\n' +
'\n' +
'See https://github.com/sanctuary-js/sanctuary-def/tree/v' + version + '#Type for information about the Type type.\n');
});

});
Expand Down Expand Up @@ -3032,7 +3044,9 @@ describe('BinaryTypeVariable', function() {
'\n' +
'1) function Number() { [native code] } :: Function\n' +
'\n' +
'The value at position 1 is not a member of ‘Type’.\n');
'The value at position 1 is not a member of ‘Type’.\n' +
'\n' +
'See https://github.com/sanctuary-js/sanctuary-def/tree/v' + version + '#Type for information about the Type type.\n');
});

});

0 comments on commit ac5b9df

Please sign in to comment.