diff --git a/index.js b/index.js index d35e240..3db2308 100644 --- a/index.js +++ b/index.js @@ -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. @@ -987,6 +996,7 @@ //. - [Array](#Array) ([Unknown][]) //. - [Boolean](#Boolean) //. - [Date](#Date) + //. - [Descending](#Descending) ([Unknown][]) //. - [Either](#Either) ([Unknown][]) ([Unknown][]) //. - [Error](#Error) //. - [HtmlElement](#HtmlElement) @@ -1006,6 +1016,7 @@ Array_ (Unknown), Boolean_, Date_, + Descending (Unknown), Either_ (Unknown) (Unknown), Error_, HtmlElement, @@ -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_), @@ -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 diff --git a/package.json b/package.json index 5b1d3de..ed99e30 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/test/index.js b/test/index.js index 8324e11..fe7018e 100644 --- a/test/index.js +++ b/test/index.js @@ -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'); @@ -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);