Skip to content

Commit

Permalink
Merge pull request #260 from sanctuary-js/davidchambers/descending
Browse files Browse the repository at this point in the history
types: define Descending type constructor
  • Loading branch information
davidchambers authored Apr 5, 2019
2 parents 8f814aa + 1f84a69 commit 74050e4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,15 @@
([Date_])
(B (complement (isNaN)) (Number));

//# Descending :: Type -> Type
//.
//. [Descending][] type constructor.
var Descending = UnaryTypeWithUrl
('Descending')
([])
(typeEq ('sanctuary-descending/Descending@1'))
(I);

//# Either :: Type -> Type -> Type
//.
//. [Either][] type constructor.
Expand Down Expand Up @@ -987,6 +996,7 @@
//. - <code>[Array](#Array) ([Unknown][])</code>
//. - <code>[Boolean](#Boolean)</code>
//. - <code>[Date](#Date)</code>
//. - <code>[Descending](#Descending) ([Unknown][])</code>
//. - <code>[Either](#Either) ([Unknown][]) ([Unknown][])</code>
//. - <code>[Error](#Error)</code>
//. - <code>[HtmlElement](#HtmlElement)</code>
Expand All @@ -1006,6 +1016,7 @@
Array_ (Unknown),
Boolean_,
Date_,
Descending (Unknown),
Either_ (Unknown) (Unknown),
Error_,
HtmlElement,
Expand Down Expand Up @@ -2785,6 +2796,7 @@
Boolean: Boolean_,
Date: Date_,
ValidDate: ValidDate,
Descending: fromUncheckedUnaryType (Descending),
Either: fromUncheckedBinaryType (Either_),
Error: Error_,
Function: def ('Function') ({}) ([Array_ (Type), Type]) (Function_),
Expand Down Expand Up @@ -2923,6 +2935,7 @@

}));

//. [Descending]: v:sanctuary-js/sanctuary-descending
//. [Either]: v:sanctuary-js/sanctuary-either
//. [FL:Semigroup]: https://github.com/fantasyland/fantasy-land#semigroup
//. [HTML element]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"sanctuary-type-identifiers": "2.0.x"
},
"devDependencies": {
"sanctuary-descending": "1.1.0",
"sanctuary-maybe": "1.1.0",
"sanctuary-pair": "1.1.0",
"sanctuary-scripts": "3.2.x"
Expand Down
15 changes: 15 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const util = require ('util');
const vm = require ('vm');

const Descending = require ('sanctuary-descending');
const {Left, Right} = require ('sanctuary-either');
const {Nothing, Just} = require ('sanctuary-maybe');
const Pair = require ('sanctuary-pair');
Expand Down Expand Up @@ -1512,6 +1513,20 @@ See https://github.com/sanctuary-js/sanctuary-def/tree/v${version}#Array2 for in
eq ($.Date.supertypes) ([]);
});

test ('provides the "Descending" type constructor', () => {
eq (typeof $.Descending) ('function');
eq ($.Descending.length) (1);
eq (show ($.Descending)) ('Descending :: Type -> Type');
eq (show ($.Descending (a))) ('(Descending a)');
eq (($.Descending (a)).name) ('Descending');
eq (($.Descending (a)).url) (`https://github.com/sanctuary-js/sanctuary-def/tree/v${version}#Descending`);

const isDescendingString = $.test ([]) ($.Descending ($.String));
eq (isDescendingString (null)) (false);
eq (isDescendingString (Descending (12.34))) (false);
eq (isDescendingString (Descending ('abc'))) (true);
});

test ('provides the "Either" type constructor', () => {
eq (typeof $.Either) ('function');
eq ($.Either.length) (1);
Expand Down

0 comments on commit 74050e4

Please sign in to comment.