sanctuary-type-classes
Advanced tools
Comparing version 4.0.0 to 5.0.0
266
index.js
@@ -36,9 +36,9 @@ /* | ||
//: (equals) (concat) (reduce) (map) (contramap) | ||
//: | \ / | | | | \ | ||
//: | \ / | | | | \ | ||
//: | \ / | | | | \ | ||
//: | \ / | | | | \ | ||
//: | \ / | | | | \ | ||
//: Monoid Traversable | | | | \ | ||
//: (empty) (traverse) / | | \ \ | ||
//: | | \ / | | | | \ | ||
//: | | \ / | | | | \ | ||
//: | | \ / | | | | \ | ||
//: | | \ / | | | | \ | ||
//: | | \ / | | | | \ | ||
//: Ord Monoid Traversable | | | | \ | ||
//: (lte) (empty) (traverse) / | | \ \ | ||
//: / | | \ \ | ||
@@ -116,2 +116,7 @@ //: / / \ \ \ | ||
// sameType :: (a, b) -> Boolean | ||
function sameType(x, y) { | ||
return typeof x === typeof y && type(x) === type(y); | ||
} | ||
// type Iteration a = { value :: a, done :: Boolean } | ||
@@ -260,2 +265,15 @@ | ||
//# Ord :: TypeClass | ||
//. | ||
//. `TypeClass` value for [Ord][]. | ||
//. | ||
//. ```javascript | ||
//. > Ord.test(0) | ||
//. true | ||
//. | ||
//. > Ord.test(Math.sqrt) | ||
//. false | ||
//. ``` | ||
var Ord = $('Ord', [Setoid], {lte: Value}); | ||
//# Semigroup :: TypeClass | ||
@@ -505,2 +523,7 @@ //. | ||
// Null$prototype$lte :: Null ~> Null -> Boolean | ||
function Null$prototype$lte(other) { | ||
return true; | ||
} | ||
// Undefined$prototype$toString :: Undefined ~> () -> String | ||
@@ -516,2 +539,7 @@ function Undefined$prototype$toString() { | ||
// Undefined$prototype$lte :: Undefined ~> Undefined -> Boolean | ||
function Undefined$prototype$lte(other) { | ||
return true; | ||
} | ||
// Boolean$prototype$toString :: Boolean ~> () -> String | ||
@@ -526,5 +554,14 @@ function Boolean$prototype$toString() { | ||
function Boolean$prototype$equals(other) { | ||
return typeof other === typeof this && other.valueOf() === this.valueOf(); | ||
return typeof this === 'object' ? | ||
equals(this.valueOf(), other.valueOf()) : | ||
this === other; | ||
} | ||
// Boolean$prototype$lte :: Boolean ~> Boolean -> Boolean | ||
function Boolean$prototype$lte(other) { | ||
return typeof this === 'object' ? | ||
lte(this.valueOf(), other.valueOf()) : | ||
this === false || other === true; | ||
} | ||
// Number$prototype$toString :: Number ~> () -> String | ||
@@ -539,9 +576,14 @@ function Number$prototype$toString() { | ||
function Number$prototype$equals(other) { | ||
return typeof other === 'object' ? | ||
typeof this === 'object' && | ||
equals(this.valueOf(), other.valueOf()) : | ||
isNaN(other) && isNaN(this) || | ||
other === this && 1 / other === 1 / this; | ||
return typeof this === 'object' ? | ||
equals(this.valueOf(), other.valueOf()) : | ||
isNaN(this) && isNaN(other) || this === other; | ||
} | ||
// Number$prototype$lte :: Number ~> Number -> Boolean | ||
function Number$prototype$lte(other) { | ||
return typeof this === 'object' ? | ||
lte(this.valueOf(), other.valueOf()) : | ||
isNaN(this) && isNaN(other) || this <= other; | ||
} | ||
// Date$prototype$toString :: Date ~> () -> String | ||
@@ -558,2 +600,7 @@ function Date$prototype$toString() { | ||
// Date$prototype$lte :: Date ~> Date -> Boolean | ||
function Date$prototype$lte(other) { | ||
return lte(this.valueOf(), other.valueOf()); | ||
} | ||
// RegExp$prototype$equals :: RegExp ~> RegExp -> Boolean | ||
@@ -591,5 +638,14 @@ function RegExp$prototype$equals(other) { | ||
function String$prototype$equals(other) { | ||
return typeof other === typeof this && other.valueOf() === this.valueOf(); | ||
return typeof this === 'object' ? | ||
equals(this.valueOf(), other.valueOf()) : | ||
this === other; | ||
} | ||
// String$prototype$lte :: String ~> String -> Boolean | ||
function String$prototype$lte(other) { | ||
return typeof this === 'object' ? | ||
lte(this.valueOf(), other.valueOf()) : | ||
this <= other; | ||
} | ||
// String$prototype$concat :: String ~> String -> String | ||
@@ -652,2 +708,11 @@ function String$prototype$concat(other) { | ||
// Array$prototype$lte :: Array a ~> Array a -> Boolean | ||
function Array$prototype$lte(other) { | ||
for (var idx = 0; true; idx += 1) { | ||
if (idx === this.length) return true; | ||
if (idx === other.length) return false; | ||
if (!equals(this[idx], other[idx])) return lte(this[idx], other[idx]); | ||
} | ||
} | ||
// Array$prototype$concat :: Array a ~> Array a -> Array a | ||
@@ -722,2 +787,7 @@ function Array$prototype$concat(other) { | ||
// Arguments$prototype$lte :: Arguments ~> Arguments -> Boolean | ||
function Arguments$prototype$lte(other) { | ||
return Array$prototype$lte.call(this, other); | ||
} | ||
// Error$prototype$toString :: Error ~> () -> String | ||
@@ -763,2 +833,17 @@ function Error$prototype$toString() { | ||
// Object$prototype$lte :: StrMap a ~> StrMap a -> Boolean | ||
function Object$prototype$lte(other) { | ||
var theseKeys = Object.keys(this).sort(); | ||
var otherKeys = Object.keys(other).sort(); | ||
while (true) { | ||
if (theseKeys.length === 0) return true; | ||
if (otherKeys.length === 0) return false; | ||
var k = theseKeys.shift(); | ||
var z = otherKeys.shift(); | ||
if (k < z) return true; | ||
if (k > z) return false; | ||
if (!equals(this[k], other[k])) return lte(this[k], other[k]); | ||
} | ||
} | ||
// Object$prototype$concat :: StrMap a ~> StrMap a -> StrMap a | ||
@@ -852,3 +937,4 @@ function Object$prototype$concat(other) { | ||
toString: Null$prototype$toString, | ||
'fantasy-land/equals': Null$prototype$equals | ||
'fantasy-land/equals': Null$prototype$equals, | ||
'fantasy-land/lte': Null$prototype$lte | ||
} | ||
@@ -859,3 +945,4 @@ }, | ||
toString: Undefined$prototype$toString, | ||
'fantasy-land/equals': Undefined$prototype$equals | ||
'fantasy-land/equals': Undefined$prototype$equals, | ||
'fantasy-land/lte': Undefined$prototype$lte | ||
} | ||
@@ -866,3 +953,4 @@ }, | ||
toString: Boolean$prototype$toString, | ||
'fantasy-land/equals': Boolean$prototype$equals | ||
'fantasy-land/equals': Boolean$prototype$equals, | ||
'fantasy-land/lte': Boolean$prototype$lte | ||
} | ||
@@ -873,3 +961,4 @@ }, | ||
toString: Number$prototype$toString, | ||
'fantasy-land/equals': Number$prototype$equals | ||
'fantasy-land/equals': Number$prototype$equals, | ||
'fantasy-land/lte': Number$prototype$lte | ||
} | ||
@@ -880,3 +969,4 @@ }, | ||
toString: Date$prototype$toString, | ||
'fantasy-land/equals': Date$prototype$equals | ||
'fantasy-land/equals': Date$prototype$equals, | ||
'fantasy-land/lte': Date$prototype$lte | ||
} | ||
@@ -894,2 +984,3 @@ }, | ||
'fantasy-land/equals': String$prototype$equals, | ||
'fantasy-land/lte': String$prototype$lte, | ||
'fantasy-land/concat': String$prototype$concat | ||
@@ -906,2 +997,3 @@ } | ||
'fantasy-land/equals': Array$prototype$equals, | ||
'fantasy-land/lte': Array$prototype$lte, | ||
'fantasy-land/concat': Array$prototype$concat, | ||
@@ -920,3 +1012,4 @@ 'fantasy-land/map': Array$prototype$map, | ||
toString: Arguments$prototype$toString, | ||
'fantasy-land/equals': Arguments$prototype$equals | ||
'fantasy-land/equals': Arguments$prototype$equals, | ||
'fantasy-land/lte': Arguments$prototype$lte | ||
} | ||
@@ -936,2 +1029,3 @@ }, | ||
'fantasy-land/equals': Object$prototype$equals, | ||
'fantasy-land/lte': Object$prototype$lte, | ||
'fantasy-land/concat': Object$prototype$concat, | ||
@@ -1024,3 +1118,3 @@ 'fantasy-land/map': Object$prototype$map, | ||
//. > equals(0, -0) | ||
//. false | ||
//. true | ||
//. | ||
@@ -1041,5 +1135,3 @@ //. > equals(NaN, NaN) | ||
return function equals(x, y) { | ||
if (type(x) !== type(y)) { | ||
return false; | ||
} | ||
if (!sameType(x, y)) return false; | ||
@@ -1061,2 +1153,121 @@ // This algorithm for comparing circular data structures was | ||
//# lt :: (a, b) -> Boolean | ||
//. | ||
//. Returns `true` if its arguments are of the same type and the first is | ||
//. less than the second according to the type's [`fantasy-land/lte`][] | ||
//. method; `false` otherwise. | ||
//. | ||
//. This function is derived from [`lte`](#lte). | ||
//. | ||
//. See also [`gt`](#gt) and [`gte`](#gte). | ||
//. | ||
//. ```javascript | ||
//. > lt(0, 0) | ||
//. false | ||
//. | ||
//. > lt(0, 1) | ||
//. true | ||
//. | ||
//. > lt(1, 0) | ||
//. false | ||
//. ``` | ||
function lt(x, y) { | ||
return sameType(x, y) && !lte(y, x); | ||
} | ||
//# lte :: (a, b) -> Boolean | ||
//. | ||
//. Returns `true` if its arguments are of the same type and the first | ||
//. is less than or equal to the second according to the type's | ||
//. [`fantasy-land/lte`][] method; `false` otherwise. | ||
//. | ||
//. `fantasy-land/lte` implementations are provided for the following | ||
//. built-in types: Null, Undefined, Boolean, Number, Date, String, Array, | ||
//. Arguments, and Object. | ||
//. | ||
//. The algorithm supports circular data structures in the same manner as | ||
//. [`equals`](#equals). | ||
//. | ||
//. See also [`lt`](#lt), [`gt`](#gt), and [`gte`](#gte). | ||
//. | ||
//. ```javascript | ||
//. > lte(0, 0) | ||
//. true | ||
//. | ||
//. > lte(0, 1) | ||
//. true | ||
//. | ||
//. > lte(1, 0) | ||
//. false | ||
//. ``` | ||
var lte = (function() { | ||
// $pairs :: Array (Pair Any Any) | ||
var $pairs = []; | ||
return function lte(x, y) { | ||
if (!sameType(x, y)) return false; | ||
// This algorithm for comparing circular data structures was | ||
// suggested in <http://stackoverflow.com/a/40622794/312785>. | ||
if ($pairs.some(function(p) { return p[0] === x && p[1] === y; })) { | ||
return equals(x, y); | ||
} | ||
$pairs.push([x, y]); | ||
try { | ||
return Ord.test(x) && Ord.test(y) && Ord.methods.lte(x)(y); | ||
} finally { | ||
$pairs.pop(); | ||
} | ||
}; | ||
}()); | ||
//# gt :: (a, b) -> Boolean | ||
//. | ||
//. Returns `true` if its arguments are of the same type and the first is | ||
//. greater than the second according to the type's [`fantasy-land/lte`][] | ||
//. method; `false` otherwise. | ||
//. | ||
//. This function is derived from [`lte`](#lte). | ||
//. | ||
//. See also [`lt`](#lt) and [`gte`](#gte). | ||
//. | ||
//. ```javascript | ||
//. > gt(0, 0) | ||
//. false | ||
//. | ||
//. > gt(0, 1) | ||
//. false | ||
//. | ||
//. > gt(1, 0) | ||
//. true | ||
//. ``` | ||
function gt(x, y) { | ||
return lt(y, x); | ||
} | ||
//# gte :: (a, b) -> Boolean | ||
//. | ||
//. Returns `true` if its arguments are of the same type and the first | ||
//. is greater than or equal to the second according to the type's | ||
//. [`fantasy-land/lte`][] method; `false` otherwise. | ||
//. | ||
//. This function is derived from [`lte`](#lte). | ||
//. | ||
//. See also [`lt`](#lt) and [`gt`](#gt). | ||
//. | ||
//. ```javascript | ||
//. > gte(0, 0) | ||
//. true | ||
//. | ||
//. > gte(0, 1) | ||
//. false | ||
//. | ||
//. > gte(1, 0) | ||
//. true | ||
//. ``` | ||
function gte(x, y) { | ||
return lte(y, x); | ||
} | ||
//# concat :: Semigroup a => (a, a) -> a | ||
@@ -1555,2 +1766,3 @@ //. | ||
Setoid: Setoid, | ||
Ord: Ord, | ||
Semigroup: Semigroup, | ||
@@ -1576,2 +1788,6 @@ Monoid: Monoid, | ||
equals: equals, | ||
lt: lt, | ||
lte: lte, | ||
gt: gt, | ||
gte: gte, | ||
concat: concat, | ||
@@ -1620,2 +1836,3 @@ empty: empty, | ||
//. [Monoid]: https://github.com/fantasyland/fantasy-land#monoid | ||
//. [Ord]: https://github.com/fantasyland/fantasy-land#ord | ||
//. [Plus]: https://github.com/fantasyland/fantasy-land#plus | ||
@@ -1637,2 +1854,3 @@ //. [Profunctor]: https://github.com/fantasyland/fantasy-land#profunctor | ||
//. [`fantasy-land/extract`]: https://github.com/fantasyland/fantasy-land#extract-method | ||
//. [`fantasy-land/lte`]: https://github.com/fantasyland/fantasy-land#lte-method | ||
//. [`fantasy-land/map`]: https://github.com/fantasyland/fantasy-land#map-method | ||
@@ -1639,0 +1857,0 @@ //. [`fantasy-land/of`]: https://github.com/fantasyland/fantasy-land#of-method |
{ | ||
"name": "sanctuary-type-classes", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "Standard library for Fantasy Land", | ||
@@ -17,5 +17,5 @@ "license": "MIT", | ||
"devDependencies": { | ||
"doctest": "0.10.x", | ||
"eslint": "2.9.x", | ||
"fantasy-land": "3.1.0", | ||
"doctest": "0.12.x", | ||
"eslint": "3.19.x", | ||
"fantasy-land": "3.2.0", | ||
"istanbul": "0.4.x", | ||
@@ -27,3 +27,3 @@ "mocha": "2.x.x", | ||
"remember-bower": "0.1.x", | ||
"sanctuary-style": "0.4.x", | ||
"sanctuary-style": "0.5.x", | ||
"transcribe": "0.5.x", | ||
@@ -30,0 +30,0 @@ "xyz": "2.0.x" |
211
README.md
@@ -23,9 +23,9 @@ # sanctuary-type-classes | ||
(<a href="#equals">equals</a>) (<a href="#concat">concat</a>) (<a href="#reduce">reduce</a>) (<a href="#map">map</a>) (<a href="#contramap">contramap</a>) | ||
| \ / | | | | \ | ||
| \ / | | | | \ | ||
| \ / | | | | \ | ||
| \ / | | | | \ | ||
| \ / | | | | \ | ||
<a href="#Monoid">Monoid</a> <a href="#Traversable">Traversable</a> | | | | \ | ||
(<a href="#empty">empty</a>) (<a href="#traverse">traverse</a>) / | | \ \ | ||
| | \ / | | | | \ | ||
| | \ / | | | | \ | ||
| | \ / | | | | \ | ||
| | \ / | | | | \ | ||
| | \ / | | | | \ | ||
<a href="#Ord">Ord</a> <a href="#Monoid">Monoid</a> <a href="#Traversable">Traversable</a> | | | | \ | ||
(<a href="#lte">lte</a>) (<a href="#empty">empty</a>) (<a href="#traverse">traverse</a>) / | | \ \ | ||
/ | | \ \ | ||
@@ -57,3 +57,3 @@ / / \ \ \ | ||
<h4 name="TypeClass"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L123">TypeClass :: (String, Array TypeClass, a -> Boolean) -> TypeClass</a></code></h4> | ||
<h4 name="TypeClass"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L128">TypeClass :: (String, Array TypeClass, a -> Boolean) -> TypeClass</a></code></h4> | ||
@@ -94,3 +94,3 @@ The arguments are: | ||
<h4 name="Setoid"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L248">Setoid :: TypeClass</a></code></h4> | ||
<h4 name="Setoid"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L253">Setoid :: TypeClass</a></code></h4> | ||
@@ -104,4 +104,16 @@ `TypeClass` value for [Setoid][]. | ||
<h4 name="Semigroup"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L258">Semigroup :: TypeClass</a></code></h4> | ||
<h4 name="Ord"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L263">Ord :: TypeClass</a></code></h4> | ||
`TypeClass` value for [Ord][]. | ||
```javascript | ||
> Ord.test(0) | ||
true | ||
> Ord.test(Math.sqrt) | ||
false | ||
``` | ||
<h4 name="Semigroup"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L276">Semigroup :: TypeClass</a></code></h4> | ||
`TypeClass` value for [Semigroup][]. | ||
@@ -117,3 +129,3 @@ | ||
<h4 name="Monoid"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L271">Monoid :: TypeClass</a></code></h4> | ||
<h4 name="Monoid"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L289">Monoid :: TypeClass</a></code></h4> | ||
@@ -130,3 +142,3 @@ `TypeClass` value for [Monoid][]. | ||
<h4 name="Functor"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L284">Functor :: TypeClass</a></code></h4> | ||
<h4 name="Functor"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L302">Functor :: TypeClass</a></code></h4> | ||
@@ -143,3 +155,3 @@ `TypeClass` value for [Functor][]. | ||
<h4 name="Bifunctor"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L297">Bifunctor :: TypeClass</a></code></h4> | ||
<h4 name="Bifunctor"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L315">Bifunctor :: TypeClass</a></code></h4> | ||
@@ -156,3 +168,3 @@ `TypeClass` value for [Bifunctor][]. | ||
<h4 name="Profunctor"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L310">Profunctor :: TypeClass</a></code></h4> | ||
<h4 name="Profunctor"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L328">Profunctor :: TypeClass</a></code></h4> | ||
@@ -169,3 +181,3 @@ `TypeClass` value for [Profunctor][]. | ||
<h4 name="Apply"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L323">Apply :: TypeClass</a></code></h4> | ||
<h4 name="Apply"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L341">Apply :: TypeClass</a></code></h4> | ||
@@ -182,3 +194,3 @@ `TypeClass` value for [Apply][]. | ||
<h4 name="Applicative"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L336">Applicative :: TypeClass</a></code></h4> | ||
<h4 name="Applicative"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L354">Applicative :: TypeClass</a></code></h4> | ||
@@ -195,3 +207,3 @@ `TypeClass` value for [Applicative][]. | ||
<h4 name="Chain"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L349">Chain :: TypeClass</a></code></h4> | ||
<h4 name="Chain"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L367">Chain :: TypeClass</a></code></h4> | ||
@@ -208,3 +220,3 @@ `TypeClass` value for [Chain][]. | ||
<h4 name="ChainRec"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L362">ChainRec :: TypeClass</a></code></h4> | ||
<h4 name="ChainRec"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L380">ChainRec :: TypeClass</a></code></h4> | ||
@@ -221,3 +233,3 @@ `TypeClass` value for [ChainRec][]. | ||
<h4 name="Monad"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L375">Monad :: TypeClass</a></code></h4> | ||
<h4 name="Monad"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L393">Monad :: TypeClass</a></code></h4> | ||
@@ -234,3 +246,3 @@ `TypeClass` value for [Monad][]. | ||
<h4 name="Alt"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L388">Alt :: TypeClass</a></code></h4> | ||
<h4 name="Alt"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L406">Alt :: TypeClass</a></code></h4> | ||
@@ -247,3 +259,3 @@ `TypeClass` value for [Alt][]. | ||
<h4 name="Plus"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L401">Plus :: TypeClass</a></code></h4> | ||
<h4 name="Plus"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L419">Plus :: TypeClass</a></code></h4> | ||
@@ -260,3 +272,3 @@ `TypeClass` value for [Plus][]. | ||
<h4 name="Alternative"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L414">Alternative :: TypeClass</a></code></h4> | ||
<h4 name="Alternative"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L432">Alternative :: TypeClass</a></code></h4> | ||
@@ -273,3 +285,3 @@ `TypeClass` value for [Alternative][]. | ||
<h4 name="Foldable"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L427">Foldable :: TypeClass</a></code></h4> | ||
<h4 name="Foldable"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L445">Foldable :: TypeClass</a></code></h4> | ||
@@ -286,3 +298,3 @@ `TypeClass` value for [Foldable][]. | ||
<h4 name="Traversable"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L440">Traversable :: TypeClass</a></code></h4> | ||
<h4 name="Traversable"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L458">Traversable :: TypeClass</a></code></h4> | ||
@@ -299,3 +311,3 @@ `TypeClass` value for [Traversable][]. | ||
<h4 name="Extend"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L453">Extend :: TypeClass</a></code></h4> | ||
<h4 name="Extend"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L471">Extend :: TypeClass</a></code></h4> | ||
@@ -312,3 +324,3 @@ `TypeClass` value for [Extend][]. | ||
<h4 name="Comonad"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L466">Comonad :: TypeClass</a></code></h4> | ||
<h4 name="Comonad"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L484">Comonad :: TypeClass</a></code></h4> | ||
@@ -325,3 +337,3 @@ `TypeClass` value for [Comonad][]. | ||
<h4 name="Contravariant"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L479">Contravariant :: TypeClass</a></code></h4> | ||
<h4 name="Contravariant"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L497">Contravariant :: TypeClass</a></code></h4> | ||
@@ -338,3 +350,3 @@ `TypeClass` value for [Contravariant][]. | ||
<h4 name="toString"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L938">toString :: a -> String</a></code></h4> | ||
<h4 name="toString"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1032">toString :: a -> String</a></code></h4> | ||
@@ -365,3 +377,3 @@ Returns a useful string representation of its argument. | ||
<h4 name="equals"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L986">equals :: (a, b) -> Boolean</a></code></h4> | ||
<h4 name="equals"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1080">equals :: (a, b) -> Boolean</a></code></h4> | ||
@@ -383,3 +395,3 @@ Returns `true` if its arguments are of the same type and equal according | ||
> equals(0, -0) | ||
false | ||
true | ||
@@ -396,4 +408,93 @@ > equals(NaN, NaN) | ||
<h4 name="concat"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1038">concat :: Semigroup a => (a, a) -> a</a></code></h4> | ||
<h4 name="lt"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1130">lt :: (a, b) -> Boolean</a></code></h4> | ||
Returns `true` if its arguments are of the same type and the first is | ||
less than the second according to the type's [`fantasy-land/lte`][] | ||
method; `false` otherwise. | ||
This function is derived from [`lte`](#lte). | ||
See also [`gt`](#gt) and [`gte`](#gte). | ||
```javascript | ||
> lt(0, 0) | ||
false | ||
> lt(0, 1) | ||
true | ||
> lt(1, 0) | ||
false | ||
``` | ||
<h4 name="lte"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1154">lte :: (a, b) -> Boolean</a></code></h4> | ||
Returns `true` if its arguments are of the same type and the first | ||
is less than or equal to the second according to the type's | ||
[`fantasy-land/lte`][] method; `false` otherwise. | ||
`fantasy-land/lte` implementations are provided for the following | ||
built-in types: Null, Undefined, Boolean, Number, Date, String, Array, | ||
Arguments, and Object. | ||
The algorithm supports circular data structures in the same manner as | ||
[`equals`](#equals). | ||
See also [`lt`](#lt), [`gt`](#gt), and [`gte`](#gte). | ||
```javascript | ||
> lte(0, 0) | ||
true | ||
> lte(0, 1) | ||
true | ||
> lte(1, 0) | ||
false | ||
``` | ||
<h4 name="gt"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1201">gt :: (a, b) -> Boolean</a></code></h4> | ||
Returns `true` if its arguments are of the same type and the first is | ||
greater than the second according to the type's [`fantasy-land/lte`][] | ||
method; `false` otherwise. | ||
This function is derived from [`lte`](#lte). | ||
See also [`lt`](#lt) and [`gte`](#gte). | ||
```javascript | ||
> gt(0, 0) | ||
false | ||
> gt(0, 1) | ||
false | ||
> gt(1, 0) | ||
true | ||
``` | ||
<h4 name="gte"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1225">gte :: (a, b) -> Boolean</a></code></h4> | ||
Returns `true` if its arguments are of the same type and the first | ||
is greater than or equal to the second according to the type's | ||
[`fantasy-land/lte`][] method; `false` otherwise. | ||
This function is derived from [`lte`](#lte). | ||
See also [`lt`](#lt) and [`gt`](#gt). | ||
```javascript | ||
> gte(0, 0) | ||
true | ||
> gte(0, 1) | ||
false | ||
> gte(1, 0) | ||
true | ||
``` | ||
<h4 name="concat"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1249">concat :: Semigroup a => (a, a) -> a</a></code></h4> | ||
Function wrapper for [`fantasy-land/concat`][]. | ||
@@ -418,3 +519,3 @@ | ||
<h4 name="empty"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1062">empty :: Monoid m => TypeRep m -> m</a></code></h4> | ||
<h4 name="empty"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1273">empty :: Monoid m => TypeRep m -> m</a></code></h4> | ||
@@ -440,3 +541,3 @@ Function wrapper for [`fantasy-land/empty`][]. | ||
<h4 name="map"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1086">map :: Functor f => (a -> b, f a) -> f b</a></code></h4> | ||
<h4 name="map"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1297">map :: Functor f => (a -> b, f a) -> f b</a></code></h4> | ||
@@ -468,3 +569,3 @@ Function wrapper for [`fantasy-land/map`][]. | ||
<h4 name="bimap"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1116">bimap :: Bifunctor f => (a -> b, c -> d, f a c) -> f b d</a></code></h4> | ||
<h4 name="bimap"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1327">bimap :: Bifunctor f => (a -> b, c -> d, f a c) -> f b d</a></code></h4> | ||
@@ -478,3 +579,3 @@ Function wrapper for [`fantasy-land/bimap`][]. | ||
<h4 name="promap"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1128">promap :: Profunctor p => (a -> b, c -> d, p b c) -> p a d</a></code></h4> | ||
<h4 name="promap"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1339">promap :: Profunctor p => (a -> b, c -> d, p b c) -> p a d</a></code></h4> | ||
@@ -491,3 +592,3 @@ Function wrapper for [`fantasy-land/promap`][]. | ||
<h4 name="ap"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1143">ap :: Apply f => (f (a -> b), f a) -> f b</a></code></h4> | ||
<h4 name="ap"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1354">ap :: Apply f => (f (a -> b), f a) -> f b</a></code></h4> | ||
@@ -516,3 +617,3 @@ Function wrapper for [`fantasy-land/ap`][]. | ||
<h4 name="lift2"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1170">lift2 :: Apply f => (a -> b -> c, f a, f b) -> f c</a></code></h4> | ||
<h4 name="lift2"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1381">lift2 :: Apply f => (a -> b -> c, f a, f b) -> f c</a></code></h4> | ||
@@ -534,3 +635,3 @@ Lifts `a -> b -> c` to `Apply f => f a -> f b -> f c` and returns the | ||
<h4 name="lift3"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1190">lift3 :: Apply f => (a -> b -> c -> d, f a, f b, f c) -> f d</a></code></h4> | ||
<h4 name="lift3"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1401">lift3 :: Apply f => (a -> b -> c -> d, f a, f b, f c) -> f d</a></code></h4> | ||
@@ -552,3 +653,3 @@ Lifts `a -> b -> c -> d` to `Apply f => f a -> f b -> f c -> f d` and | ||
<h4 name="apFirst"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1210">apFirst :: Apply f => (f a, f b) -> f a</a></code></h4> | ||
<h4 name="apFirst"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1421">apFirst :: Apply f => (f a, f b) -> f a</a></code></h4> | ||
@@ -570,3 +671,3 @@ Combines two effectful actions, keeping only the result of the first. | ||
<h4 name="apSecond"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1230">apSecond :: Apply f => (f a, f b) -> f b</a></code></h4> | ||
<h4 name="apSecond"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1441">apSecond :: Apply f => (f a, f b) -> f b</a></code></h4> | ||
@@ -588,3 +689,3 @@ Combines two effectful actions, keeping only the result of the second. | ||
<h4 name="of"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1250">of :: Applicative f => (TypeRep f, a) -> f a</a></code></h4> | ||
<h4 name="of"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1461">of :: Applicative f => (TypeRep f, a) -> f a</a></code></h4> | ||
@@ -607,3 +708,3 @@ Function wrapper for [`fantasy-land/of`][]. | ||
<h4 name="chain"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1271">chain :: Chain m => (a -> m b, m a) -> m b</a></code></h4> | ||
<h4 name="chain"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1482">chain :: Chain m => (a -> m b, m a) -> m b</a></code></h4> | ||
@@ -626,3 +727,3 @@ Function wrapper for [`fantasy-land/chain`][]. | ||
<h4 name="join"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1292">join :: Chain m => m (m a) -> m a</a></code></h4> | ||
<h4 name="join"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1503">join :: Chain m => m (m a) -> m a</a></code></h4> | ||
@@ -644,3 +745,3 @@ Removes one level of nesting from a nested monadic structure. | ||
<h4 name="chainRec"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1312">chainRec :: ChainRec m => (TypeRep m, (a -> c, b -> c, a) -> m c, a) -> m b</a></code></h4> | ||
<h4 name="chainRec"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1523">chainRec :: ChainRec m => (TypeRep m, (a -> c, b -> c, a) -> m c, a) -> m b</a></code></h4> | ||
@@ -662,3 +763,3 @@ Function wrapper for [`fantasy-land/chainRec`][]. | ||
<h4 name="filter"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1332">filter :: (Applicative f, Foldable f, Monoid (f a)) => (a -> Boolean, f a) -> f a</a></code></h4> | ||
<h4 name="filter"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1543">filter :: (Applicative f, Foldable f, Monoid (f a)) => (a -> Boolean, f a) -> f a</a></code></h4> | ||
@@ -680,3 +781,3 @@ Filters its second argument in accordance with the given predicate. | ||
<h4 name="filterM"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1355">filterM :: (Alternative m, Monad m) => (a -> Boolean, m a) -> m a</a></code></h4> | ||
<h4 name="filterM"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1566">filterM :: (Alternative m, Monad m) => (a -> Boolean, m a) -> m a</a></code></h4> | ||
@@ -707,3 +808,3 @@ Filters its second argument in accordance with the given predicate. | ||
<h4 name="alt"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1386">alt :: Alt f => (f a, f a) -> f a</a></code></h4> | ||
<h4 name="alt"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1597">alt :: Alt f => (f a, f a) -> f a</a></code></h4> | ||
@@ -729,3 +830,3 @@ Function wrapper for [`fantasy-land/alt`][]. | ||
<h4 name="zero"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1410">zero :: Plus f => TypeRep f -> f a</a></code></h4> | ||
<h4 name="zero"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1621">zero :: Plus f => TypeRep f -> f a</a></code></h4> | ||
@@ -748,3 +849,3 @@ Function wrapper for [`fantasy-land/zero`][]. | ||
<h4 name="reduce"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1431">reduce :: Foldable f => ((b, a) -> b, b, f a) -> b</a></code></h4> | ||
<h4 name="reduce"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1642">reduce :: Foldable f => ((b, a) -> b, b, f a) -> b</a></code></h4> | ||
@@ -764,3 +865,3 @@ Function wrapper for [`fantasy-land/reduce`][]. | ||
<h4 name="traverse"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1449">traverse :: (Applicative f, Traversable t) => (TypeRep f, a -> f b, t a) -> f (t b)</a></code></h4> | ||
<h4 name="traverse"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1660">traverse :: (Applicative f, Traversable t) => (TypeRep f, a -> f b, t a) -> f (t b)</a></code></h4> | ||
@@ -782,3 +883,3 @@ Function wrapper for [`fantasy-land/traverse`][]. | ||
<h4 name="sequence"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1469">sequence :: (Applicative f, Traversable t) => (TypeRep f, t (f a)) -> f (t a)</a></code></h4> | ||
<h4 name="sequence"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1680">sequence :: (Applicative f, Traversable t) => (TypeRep f, t (f a)) -> f (t a)</a></code></h4> | ||
@@ -797,3 +898,3 @@ Inverts the given `t (f a)` to produce an `f (t a)`. | ||
<h4 name="extend"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1486">extend :: Extend w => (w a -> b, w a) -> w b</a></code></h4> | ||
<h4 name="extend"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1697">extend :: Extend w => (w a -> b, w a) -> w b</a></code></h4> | ||
@@ -810,3 +911,3 @@ Function wrapper for [`fantasy-land/extend`][]. | ||
<h4 name="extract"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1501">extract :: Comonad w => w a -> a</a></code></h4> | ||
<h4 name="extract"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1712">extract :: Comonad w => w a -> a</a></code></h4> | ||
@@ -820,3 +921,3 @@ Function wrapper for [`fantasy-land/extract`][]. | ||
<h4 name="contramap"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v4.0.0/index.js#L1513">contramap :: Contravariant f => (b -> a, f a) -> f b</a></code></h4> | ||
<h4 name="contramap"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v5.0.0/index.js#L1724">contramap :: Contravariant f => (b -> a, f a) -> f b</a></code></h4> | ||
@@ -848,2 +949,3 @@ Function wrapper for [`fantasy-land/contramap`][]. | ||
[Monoid]: https://github.com/fantasyland/fantasy-land#monoid | ||
[Ord]: https://github.com/fantasyland/fantasy-land#ord | ||
[Plus]: https://github.com/fantasyland/fantasy-land#plus | ||
@@ -865,2 +967,3 @@ [Profunctor]: https://github.com/fantasyland/fantasy-land#profunctor | ||
[`fantasy-land/extract`]: https://github.com/fantasyland/fantasy-land#extract-method | ||
[`fantasy-land/lte`]: https://github.com/fantasyland/fantasy-land#lte-method | ||
[`fantasy-land/map`]: https://github.com/fantasyland/fantasy-land#map-method | ||
@@ -867,0 +970,0 @@ [`fantasy-land/of`]: https://github.com/fantasyland/fantasy-land#of-method |
86234
1682
926