sanctuary-type-classes
Advanced tools
Comparing version 3.0.1 to 3.1.0
77
index.js
@@ -34,4 +34,4 @@ /* | ||
//. <pre> | ||
//: Setoid Semigroup Foldable Functor | ||
//: (equals) (concat) (reduce) (map) | ||
//: Setoid Semigroup Foldable Functor Contravariant | ||
//: (equals) (concat) (reduce) (map) (contramap) | ||
//: | \ / | | | | \ | ||
@@ -200,2 +200,11 @@ //: | \ / | | | | \ | ||
// functionName :: Function -> String | ||
var functionName = 'name' in function f() {} ? | ||
function functionName(f) { return f.name; } : | ||
/* istanbul ignore next */ | ||
function functionName(f) { | ||
var match = /function (\w*)/.exec(f); | ||
return match == null ? '' : match[1]; | ||
}; | ||
// $ :: (String, Array TypeClass, StrMap (Array Location)) -> TypeClass | ||
@@ -207,4 +216,6 @@ function $(_name, dependencies, requirements) { | ||
function(typeRep) { | ||
return funcPath([name], typeRep) || | ||
implPath([/function (\w*)/.exec(typeRep)[1], name]); | ||
var f = funcPath([name], typeRep); | ||
return f == null && typeof typeRep === 'function' ? | ||
implPath([functionName(typeRep), name]) : | ||
f; | ||
} : | ||
@@ -323,3 +334,3 @@ function(x) { | ||
//. | ||
//. > Apply.test({}) | ||
//. > Apply.test('') | ||
//. false | ||
@@ -472,2 +483,15 @@ //. ``` | ||
//# Contravariant :: TypeClass | ||
//. | ||
//. `TypeClass` value for [Contravariant][]. | ||
//. | ||
//. ```javascript | ||
//. > Contravariant.test(Math.sqrt) | ||
//. true | ||
//. | ||
//. > Contravariant.test([]) | ||
//. false | ||
//. ``` | ||
var Contravariant = $('Contravariant', [], {contramap: Value}); | ||
// Null$prototype$toString :: Null ~> () -> String | ||
@@ -748,2 +772,9 @@ function Null$prototype$toString() { | ||
// Object$prototype$ap :: StrMap a ~> StrMap (a -> b) -> StrMap b | ||
function Object$prototype$ap(other) { | ||
var result = {}; | ||
for (var k in this) if (k in other) result[k] = other[k](this[k]); | ||
return result; | ||
} | ||
// Object$prototype$alt :: StrMap a ~> StrMap a -> StrMap a | ||
@@ -804,2 +835,8 @@ var Object$prototype$alt = Object$prototype$concat; | ||
// Function$prototype$contramap :: (b -> c) ~> (a -> b) -> (a -> c) | ||
function Function$prototype$contramap(f) { | ||
var contravariant = this; | ||
return function(x) { return contravariant(f(x)); }; | ||
} | ||
/* eslint-disable key-spacing */ | ||
@@ -888,2 +925,3 @@ var implementations = { | ||
'fantasy-land/map': Object$prototype$map, | ||
'fantasy-land/ap': Object$prototype$ap, | ||
'fantasy-land/alt': Object$prototype$alt, | ||
@@ -901,3 +939,4 @@ 'fantasy-land/reduce': Object$prototype$reduce | ||
'fantasy-land/ap': Function$prototype$ap, | ||
'fantasy-land/chain': Function$prototype$chain | ||
'fantasy-land/chain': Function$prototype$chain, | ||
'fantasy-land/contramap': Function$prototype$contramap | ||
} | ||
@@ -1118,3 +1157,3 @@ } | ||
//. `fantasy-land/ap` implementations are provided for the following | ||
//. built-in types: Array and Function. | ||
//. built-in types: Array, Object, and Function. | ||
//. | ||
@@ -1125,2 +1164,5 @@ //. ```javascript | ||
//. | ||
//. > ap({a: Math.sqrt, b: x => x * x}, {a: 16, b: 10, c: 1}) | ||
//. {a: 4, b: 100} | ||
//. | ||
//. > ap(s => n => s.slice(0, n), s => Math.ceil(s.length / 2))('Haskell') | ||
@@ -1473,2 +1515,17 @@ //. 'Hask' | ||
//# contramap :: Contravariant f => (b -> a, f a) -> f b | ||
//. | ||
//. Function wrapper for [`fantasy-land/contramap`][]. | ||
//. | ||
//. `fantasy-land/contramap` implementations are provided for the following | ||
//. built-in types: Function. | ||
//. | ||
//. ```javascript | ||
//. > contramap(s => s.length, Math.sqrt)('Sanctuary') | ||
//. 3 | ||
//. ``` | ||
function contramap(f, contravariant) { | ||
return Contravariant.methods.contramap(contravariant)(f); | ||
} | ||
return { | ||
@@ -1494,2 +1551,3 @@ TypeClass: TypeClass, | ||
Comonad: Comonad, | ||
Contravariant: Contravariant, | ||
toString: toString, | ||
@@ -1519,3 +1577,4 @@ equals: equals, | ||
extend: extend, | ||
extract: extract | ||
extract: extract, | ||
contramap: contramap | ||
}; | ||
@@ -1533,2 +1592,3 @@ | ||
//. [Comonad]: https://github.com/fantasyland/fantasy-land#comonad | ||
//. [Contravariant]: https://github.com/fantasyland/fantasy-land#contravariant | ||
//. [Extend]: https://github.com/fantasyland/fantasy-land#extend | ||
@@ -1551,2 +1611,3 @@ //. [FL]: https://github.com/fantasyland/fantasy-land | ||
//. [`fantasy-land/concat`]: https://github.com/fantasyland/fantasy-land#concat-method | ||
//. [`fantasy-land/contramap`]: https://github.com/fantasyland/fantasy-land#contramap-method | ||
//. [`fantasy-land/empty`]: https://github.com/fantasyland/fantasy-land#empty-method | ||
@@ -1553,0 +1614,0 @@ //. [`fantasy-land/equals`]: https://github.com/fantasyland/fantasy-land#equals-method |
{ | ||
"name": "sanctuary-type-classes", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "Standard library for Fantasy Land", | ||
@@ -19,5 +19,8 @@ "license": "MIT", | ||
"eslint": "2.9.x", | ||
"fantasy-land": "3.0.0", | ||
"fantasy-land": "3.1.0", | ||
"istanbul": "0.4.x", | ||
"mocha": "2.x.x", | ||
"remark-cli": "3.x.x", | ||
"remark-lint-no-undefined-references": "1.x.x", | ||
"remark-lint-no-unused-definitions": "1.x.x", | ||
"remember-bower": "0.1.x", | ||
@@ -24,0 +27,0 @@ "sanctuary-style": "0.4.x", |
125
README.md
@@ -21,4 +21,4 @@ # sanctuary-type-classes | ||
<pre> | ||
<a href="#Setoid">Setoid</a> <a href="#Semigroup">Semigroup</a> <a href="#Foldable">Foldable</a> <a href="#Functor">Functor</a> | ||
(<a href="#equals">equals</a>) (<a href="#concat">concat</a>) (<a href="#reduce">reduce</a>) (<a href="#map">map</a>) | ||
<a href="#Setoid">Setoid</a> <a href="#Semigroup">Semigroup</a> <a href="#Foldable">Foldable</a> <a href="#Functor">Functor</a> <a href="#Contravariant">Contravariant</a> | ||
(<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>) | ||
| \ / | | | | \ | ||
@@ -57,3 +57,3 @@ | \ / | | | | \ | ||
<h4 name="TypeClass"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/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/v3.1.0/index.js#L123">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/v3.0.1/index.js#L237">Setoid :: TypeClass</a></code></h4> | ||
<h4 name="Setoid"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L248">Setoid :: TypeClass</a></code></h4> | ||
@@ -104,3 +104,3 @@ `TypeClass` value for [Setoid][]. | ||
<h4 name="Semigroup"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L247">Semigroup :: TypeClass</a></code></h4> | ||
<h4 name="Semigroup"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L258">Semigroup :: TypeClass</a></code></h4> | ||
@@ -117,3 +117,3 @@ `TypeClass` value for [Semigroup][]. | ||
<h4 name="Monoid"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L260">Monoid :: TypeClass</a></code></h4> | ||
<h4 name="Monoid"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L271">Monoid :: TypeClass</a></code></h4> | ||
@@ -130,3 +130,3 @@ `TypeClass` value for [Monoid][]. | ||
<h4 name="Functor"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L273">Functor :: TypeClass</a></code></h4> | ||
<h4 name="Functor"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L284">Functor :: TypeClass</a></code></h4> | ||
@@ -143,3 +143,3 @@ `TypeClass` value for [Functor][]. | ||
<h4 name="Bifunctor"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L286">Bifunctor :: TypeClass</a></code></h4> | ||
<h4 name="Bifunctor"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L297">Bifunctor :: TypeClass</a></code></h4> | ||
@@ -156,3 +156,3 @@ `TypeClass` value for [Bifunctor][]. | ||
<h4 name="Profunctor"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L299">Profunctor :: TypeClass</a></code></h4> | ||
<h4 name="Profunctor"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L310">Profunctor :: TypeClass</a></code></h4> | ||
@@ -169,3 +169,3 @@ `TypeClass` value for [Profunctor][]. | ||
<h4 name="Apply"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L312">Apply :: TypeClass</a></code></h4> | ||
<h4 name="Apply"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L323">Apply :: TypeClass</a></code></h4> | ||
@@ -178,7 +178,7 @@ `TypeClass` value for [Apply][]. | ||
> Apply.test({}) | ||
> Apply.test('') | ||
false | ||
``` | ||
<h4 name="Applicative"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L325">Applicative :: TypeClass</a></code></h4> | ||
<h4 name="Applicative"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L336">Applicative :: TypeClass</a></code></h4> | ||
@@ -195,3 +195,3 @@ `TypeClass` value for [Applicative][]. | ||
<h4 name="Chain"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L338">Chain :: TypeClass</a></code></h4> | ||
<h4 name="Chain"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L349">Chain :: TypeClass</a></code></h4> | ||
@@ -208,3 +208,3 @@ `TypeClass` value for [Chain][]. | ||
<h4 name="ChainRec"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L351">ChainRec :: TypeClass</a></code></h4> | ||
<h4 name="ChainRec"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L362">ChainRec :: TypeClass</a></code></h4> | ||
@@ -221,3 +221,3 @@ `TypeClass` value for [ChainRec][]. | ||
<h4 name="Monad"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L364">Monad :: TypeClass</a></code></h4> | ||
<h4 name="Monad"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L375">Monad :: TypeClass</a></code></h4> | ||
@@ -234,3 +234,3 @@ `TypeClass` value for [Monad][]. | ||
<h4 name="Alt"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L377">Alt :: TypeClass</a></code></h4> | ||
<h4 name="Alt"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L388">Alt :: TypeClass</a></code></h4> | ||
@@ -247,3 +247,3 @@ `TypeClass` value for [Alt][]. | ||
<h4 name="Plus"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L390">Plus :: TypeClass</a></code></h4> | ||
<h4 name="Plus"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L401">Plus :: TypeClass</a></code></h4> | ||
@@ -260,3 +260,3 @@ `TypeClass` value for [Plus][]. | ||
<h4 name="Alternative"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L403">Alternative :: TypeClass</a></code></h4> | ||
<h4 name="Alternative"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L414">Alternative :: TypeClass</a></code></h4> | ||
@@ -273,3 +273,3 @@ `TypeClass` value for [Alternative][]. | ||
<h4 name="Foldable"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L416">Foldable :: TypeClass</a></code></h4> | ||
<h4 name="Foldable"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L427">Foldable :: TypeClass</a></code></h4> | ||
@@ -286,3 +286,3 @@ `TypeClass` value for [Foldable][]. | ||
<h4 name="Traversable"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L429">Traversable :: TypeClass</a></code></h4> | ||
<h4 name="Traversable"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L440">Traversable :: TypeClass</a></code></h4> | ||
@@ -299,3 +299,3 @@ `TypeClass` value for [Traversable][]. | ||
<h4 name="Extend"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L442">Extend :: TypeClass</a></code></h4> | ||
<h4 name="Extend"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L453">Extend :: TypeClass</a></code></h4> | ||
@@ -312,3 +312,3 @@ `TypeClass` value for [Extend][]. | ||
<h4 name="Comonad"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L455">Comonad :: TypeClass</a></code></h4> | ||
<h4 name="Comonad"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L466">Comonad :: TypeClass</a></code></h4> | ||
@@ -325,4 +325,16 @@ `TypeClass` value for [Comonad][]. | ||
<h4 name="toString"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L899">toString :: a -> String</a></code></h4> | ||
<h4 name="Contravariant"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L479">Contravariant :: TypeClass</a></code></h4> | ||
`TypeClass` value for [Contravariant][]. | ||
```javascript | ||
> Contravariant.test(Math.sqrt) | ||
true | ||
> Contravariant.test([]) | ||
false | ||
``` | ||
<h4 name="toString"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L938">toString :: a -> String</a></code></h4> | ||
Returns a useful string representation of its argument. | ||
@@ -352,3 +364,3 @@ | ||
<h4 name="equals"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L947">equals :: (a, b) -> Boolean</a></code></h4> | ||
<h4 name="equals"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L986">equals :: (a, b) -> Boolean</a></code></h4> | ||
@@ -382,3 +394,3 @@ Returns `true` if its arguments are of the same type and equal according | ||
<h4 name="concat"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L999">concat :: Semigroup a => (a, a) -> a</a></code></h4> | ||
<h4 name="concat"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L1038">concat :: Semigroup a => (a, a) -> a</a></code></h4> | ||
@@ -404,3 +416,3 @@ Function wrapper for [`fantasy-land/concat`][]. | ||
<h4 name="empty"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L1023">empty :: Monoid m => TypeRep m -> m</a></code></h4> | ||
<h4 name="empty"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L1062">empty :: Monoid m => TypeRep m -> m</a></code></h4> | ||
@@ -426,3 +438,3 @@ Function wrapper for [`fantasy-land/empty`][]. | ||
<h4 name="map"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L1047">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/v3.1.0/index.js#L1086">map :: Functor f => (a -> b, f a) -> f b</a></code></h4> | ||
@@ -454,3 +466,3 @@ Function wrapper for [`fantasy-land/map`][]. | ||
<h4 name="bimap"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L1077">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/v3.1.0/index.js#L1116">bimap :: Bifunctor f => (a -> b, c -> d, f a c) -> f b d</a></code></h4> | ||
@@ -464,3 +476,3 @@ Function wrapper for [`fantasy-land/bimap`][]. | ||
<h4 name="promap"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L1089">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/v3.1.0/index.js#L1128">promap :: Profunctor p => (a -> b, c -> d, p b c) -> p a d</a></code></h4> | ||
@@ -477,3 +489,3 @@ Function wrapper for [`fantasy-land/promap`][]. | ||
<h4 name="ap"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L1104">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/v3.1.0/index.js#L1143">ap :: Apply f => (f (a -> b), f a) -> f b</a></code></h4> | ||
@@ -483,3 +495,3 @@ Function wrapper for [`fantasy-land/ap`][]. | ||
`fantasy-land/ap` implementations are provided for the following | ||
built-in types: Array and Function. | ||
built-in types: Array, Object, and Function. | ||
@@ -490,2 +502,5 @@ ```javascript | ||
> ap({a: Math.sqrt, b: x => x * x}, {a: 16, b: 10, c: 1}) | ||
{a: 4, b: 100} | ||
> ap(s => n => s.slice(0, n), s => Math.ceil(s.length / 2))('Haskell') | ||
@@ -501,3 +516,3 @@ 'Hask' | ||
<h4 name="lift2"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L1128">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/v3.1.0/index.js#L1170">lift2 :: Apply f => (a -> b -> c, f a, f b) -> f c</a></code></h4> | ||
@@ -519,3 +534,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/v3.0.1/index.js#L1148">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/v3.1.0/index.js#L1190">lift3 :: Apply f => (a -> b -> c -> d, f a, f b, f c) -> f d</a></code></h4> | ||
@@ -537,3 +552,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/v3.0.1/index.js#L1168">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/v3.1.0/index.js#L1210">apFirst :: Apply f => (f a, f b) -> f a</a></code></h4> | ||
@@ -555,3 +570,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/v3.0.1/index.js#L1188">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/v3.1.0/index.js#L1230">apSecond :: Apply f => (f a, f b) -> f b</a></code></h4> | ||
@@ -573,3 +588,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/v3.0.1/index.js#L1208">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/v3.1.0/index.js#L1250">of :: Applicative f => (TypeRep f, a) -> f a</a></code></h4> | ||
@@ -592,3 +607,3 @@ Function wrapper for [`fantasy-land/of`][]. | ||
<h4 name="chain"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L1229">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/v3.1.0/index.js#L1271">chain :: Chain m => (a -> m b, m a) -> m b</a></code></h4> | ||
@@ -611,3 +626,3 @@ Function wrapper for [`fantasy-land/chain`][]. | ||
<h4 name="join"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L1250">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/v3.1.0/index.js#L1292">join :: Chain m => m (m a) -> m a</a></code></h4> | ||
@@ -629,3 +644,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/v3.0.1/index.js#L1270">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/v3.1.0/index.js#L1312">chainRec :: ChainRec m => (TypeRep m, (a -> c, b -> c, a) -> m c, a) -> m b</a></code></h4> | ||
@@ -647,3 +662,3 @@ Function wrapper for [`fantasy-land/chainRec`][]. | ||
<h4 name="filter"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L1290">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/v3.1.0/index.js#L1332">filter :: (Applicative f, Foldable f, Monoid (f a)) => (a -> Boolean, f a) -> f a</a></code></h4> | ||
@@ -665,3 +680,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/v3.0.1/index.js#L1313">filterM :: (Monad m, Monoid (m a)) => (a -> Boolean, m a) -> m a</a></code></h4> | ||
<h4 name="filterM"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L1355">filterM :: (Monad m, Monoid (m a)) => (a -> Boolean, m a) -> m a</a></code></h4> | ||
@@ -683,3 +698,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/v3.0.1/index.js#L1335">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/v3.1.0/index.js#L1377">alt :: Alt f => (f a, f a) -> f a</a></code></h4> | ||
@@ -705,3 +720,3 @@ Function wrapper for [`fantasy-land/alt`][]. | ||
<h4 name="zero"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L1359">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/v3.1.0/index.js#L1401">zero :: Plus f => TypeRep f -> f a</a></code></h4> | ||
@@ -724,3 +739,3 @@ Function wrapper for [`fantasy-land/zero`][]. | ||
<h4 name="reduce"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L1380">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/v3.1.0/index.js#L1422">reduce :: Foldable f => ((b, a) -> b, b, f a) -> b</a></code></h4> | ||
@@ -740,3 +755,3 @@ Function wrapper for [`fantasy-land/reduce`][]. | ||
<h4 name="traverse"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L1398">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/v3.1.0/index.js#L1440">traverse :: (Applicative f, Traversable t) => (TypeRep f, a -> f b, t a) -> f (t b)</a></code></h4> | ||
@@ -758,3 +773,3 @@ Function wrapper for [`fantasy-land/traverse`][]. | ||
<h4 name="sequence"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L1418">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/v3.1.0/index.js#L1460">sequence :: (Applicative f, Traversable t) => (TypeRep f, t (f a)) -> f (t a)</a></code></h4> | ||
@@ -773,3 +788,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/v3.0.1/index.js#L1435">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/v3.1.0/index.js#L1477">extend :: Extend w => (w a -> b, w a) -> w b</a></code></h4> | ||
@@ -786,3 +801,3 @@ Function wrapper for [`fantasy-land/extend`][]. | ||
<h4 name="extract"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.0.1/index.js#L1450">extract :: Comonad w => w a -> a</a></code></h4> | ||
<h4 name="extract"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L1492">extract :: Comonad w => w a -> a</a></code></h4> | ||
@@ -796,2 +811,14 @@ Function wrapper for [`fantasy-land/extract`][]. | ||
<h4 name="contramap"><code><a href="https://github.com/sanctuary-js/sanctuary-type-classes/blob/v3.1.0/index.js#L1504">contramap :: Contravariant f => (b -> a, f a) -> f b</a></code></h4> | ||
Function wrapper for [`fantasy-land/contramap`][]. | ||
`fantasy-land/contramap` implementations are provided for the following | ||
built-in types: Function. | ||
```javascript | ||
> contramap(s => s.length, Math.sqrt)('Sanctuary') | ||
3 | ||
``` | ||
[Alt]: https://github.com/fantasyland/fantasy-land#alt | ||
@@ -805,2 +832,3 @@ [Alternative]: https://github.com/fantasyland/fantasy-land#alternative | ||
[Comonad]: https://github.com/fantasyland/fantasy-land#comonad | ||
[Contravariant]: https://github.com/fantasyland/fantasy-land#contravariant | ||
[Extend]: https://github.com/fantasyland/fantasy-land#extend | ||
@@ -823,2 +851,3 @@ [FL]: https://github.com/fantasyland/fantasy-land | ||
[`fantasy-land/concat`]: https://github.com/fantasyland/fantasy-land#concat-method | ||
[`fantasy-land/contramap`]: https://github.com/fantasyland/fantasy-land#contramap-method | ||
[`fantasy-land/empty`]: https://github.com/fantasyland/fantasy-land#empty-method | ||
@@ -825,0 +854,0 @@ [`fantasy-land/equals`]: https://github.com/fantasyland/fantasy-land#equals-method |
77240
1473
814
12