diff --git a/README.md b/README.md
index de7c0e8..6f37377 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,7 @@ This project provides:
## API
-
+#### `TypeClass :: (String, String, Array TypeClass, a -> Boolean) -> TypeClass`
The arguments are:
@@ -100,7 +100,7 @@ dependencies; `false` otherwise.
to define parametrically polymorphic functions which verify their
type-class constraints at run time.
-
+#### `Setoid :: TypeClass`
`TypeClass` value for [Setoid][].
@@ -109,7 +109,7 @@ type-class constraints at run time.
true
```
-
+#### `Ord :: TypeClass`
`TypeClass` value for [Ord][].
@@ -121,7 +121,7 @@ true
false
```
-
+#### `Semigroupoid :: TypeClass`
`TypeClass` value for [Semigroupoid][].
@@ -133,7 +133,7 @@ true
false
```
-
+#### `Category :: TypeClass`
`TypeClass` value for [Category][].
@@ -145,7 +145,7 @@ true
false
```
-
+#### `Semigroup :: TypeClass`
`TypeClass` value for [Semigroup][].
@@ -157,7 +157,7 @@ true
false
```
-
+#### `Monoid :: TypeClass`
`TypeClass` value for [Monoid][].
@@ -169,7 +169,7 @@ true
false
```
-
+#### `Group :: TypeClass`
`TypeClass` value for [Group][].
@@ -181,7 +181,7 @@ true
false
```
-
+#### `Filterable :: TypeClass`
`TypeClass` value for [Filterable][].
@@ -193,7 +193,7 @@ true
false
```
-
+#### `Functor :: TypeClass`
`TypeClass` value for [Functor][].
@@ -205,7 +205,7 @@ true
false
```
-
+#### `Bifunctor :: TypeClass`
`TypeClass` value for [Bifunctor][].
@@ -217,7 +217,7 @@ true
false
```
-
+#### `Profunctor :: TypeClass`
`TypeClass` value for [Profunctor][].
@@ -229,7 +229,7 @@ true
false
```
-
+#### `Apply :: TypeClass`
`TypeClass` value for [Apply][].
@@ -241,7 +241,7 @@ true
false
```
-
+#### `Applicative :: TypeClass`
`TypeClass` value for [Applicative][].
@@ -253,7 +253,7 @@ true
false
```
-
+#### `Chain :: TypeClass`
`TypeClass` value for [Chain][].
@@ -265,7 +265,7 @@ true
false
```
-
+#### `ChainRec :: TypeClass`
`TypeClass` value for [ChainRec][].
@@ -277,7 +277,7 @@ true
false
```
-
+#### `Monad :: TypeClass`
`TypeClass` value for [Monad][].
@@ -289,7 +289,7 @@ true
false
```
-
+#### `Alt :: TypeClass`
`TypeClass` value for [Alt][].
@@ -301,7 +301,7 @@ true
false
```
-
+#### `Plus :: TypeClass`
`TypeClass` value for [Plus][].
@@ -313,7 +313,7 @@ true
false
```
-
+#### `Alternative :: TypeClass`
`TypeClass` value for [Alternative][].
@@ -325,7 +325,7 @@ true
false
```
-
+#### `Foldable :: TypeClass`
`TypeClass` value for [Foldable][].
@@ -337,7 +337,7 @@ true
false
```
-
+#### `Traversable :: TypeClass`
`TypeClass` value for [Traversable][].
@@ -349,7 +349,7 @@ true
false
```
-
+#### `Extend :: TypeClass`
`TypeClass` value for [Extend][].
@@ -361,7 +361,7 @@ true
false
```
-
+#### `Comonad :: TypeClass`
`TypeClass` value for [Comonad][].
@@ -373,7 +373,7 @@ true
false
```
-
+#### `Contravariant :: TypeClass`
`TypeClass` value for [Contravariant][].
@@ -385,7 +385,7 @@ true
false
```
-
+#### `toString :: a -> String`
Returns a useful string representation of its argument.
@@ -411,7 +411,7 @@ and Object.
'Cons(1, Cons(2, Cons(3, Nil)))'
```
-
+#### `equals :: (a, b) -> Boolean`
Returns `true` if its arguments are of the same type and equal according
to the type's [`fantasy-land/equals`][] method; `false` otherwise.
@@ -440,7 +440,7 @@ true
false
```
-
+#### `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`][]
@@ -461,7 +461,7 @@ true
false
```
-
+#### `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
@@ -487,7 +487,7 @@ true
false
```
-
+#### `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`][]
@@ -508,7 +508,7 @@ false
true
```
-
+#### `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
@@ -529,7 +529,7 @@ false
true
```
-
+#### `min :: Ord a => (a, a) -> a`
Returns the smaller of its two arguments.
@@ -548,7 +548,7 @@ new Date('1999-12-31')
'10'
```
-
+#### `max :: Ord a => (a, a) -> a`
Returns the larger of its two arguments.
@@ -567,7 +567,7 @@ new Date('2000-01-01')
'2'
```
-
+#### `compose :: Semigroupoid c => (c j k, c i j) -> c i k`
Function wrapper for [`fantasy-land/compose`][].
@@ -579,7 +579,7 @@ built-in types: Function.
10
```
-
+#### `id :: Category c => TypeRep c -> c`
Function wrapper for [`fantasy-land/id`][].
@@ -591,7 +591,7 @@ built-in types: Function.
'foo'
```
-
+#### `concat :: Semigroup a => (a, a) -> a`
Function wrapper for [`fantasy-land/concat`][].
@@ -612,7 +612,7 @@ built-in types: String, Array, and Object.
Cons('foo', Cons('bar', Cons('baz', Cons('quux', Nil))))
```
-
+#### `empty :: Monoid m => TypeRep m -> m`
Function wrapper for [`fantasy-land/empty`][].
@@ -633,7 +633,7 @@ built-in types: String, Array, and Object.
Nil
```
-
+#### `invert :: Group g => g -> g`
Function wrapper for [`fantasy-land/invert`][].
@@ -642,7 +642,7 @@ Function wrapper for [`fantasy-land/invert`][].
Sum(-5)
```
-
+#### `filter :: Filterable f => (a -> Boolean, f a) -> f a`
Function wrapper for [`fantasy-land/filter`][]. Discards every element
which does not satisfy the predicate.
@@ -672,7 +672,7 @@ Nothing
Just(1)
```
-
+#### `reject :: Filterable f => (a -> Boolean, f a) -> f a`
Discards every element which satisfies the predicate.
@@ -698,7 +698,7 @@ Just(0)
Nothing
```
-
+#### `takeWhile :: Filterable f => (a -> Boolean, f a) -> f a`
Discards the first element which does not satisfy the predicate, and all
subsequent elements.
@@ -718,7 +718,7 @@ See also [`dropWhile`](#dropWhile).
[]
```
-
+#### `dropWhile :: Filterable f => (a -> Boolean, f a) -> f a`
Retains the first element which does not satisfy the predicate, and all
subsequent elements.
@@ -738,7 +738,7 @@ See also [`takeWhile`](#takeWhile).
['xy', 'xz', 'yx', 'yz', 'zx', 'zy']
```
-
+#### `map :: Functor f => (a -> b, f a) -> f b`
Function wrapper for [`fantasy-land/map`][].
@@ -765,7 +765,27 @@ Nil
Cons(1, Cons(2, Cons(3, Nil)))
```
-
+#### `flip :: Functor f => (f (a -> b), a) -> f b`
+
+Maps over the given functions, applying each to the given value.
+
+This function is derived from [`map`](#map).
+
+```javascript
+> flip(x => y => x + y, '!')('foo')
+'foo!'
+
+> flip([Math.floor, Math.ceil], 1.5)
+[1, 2]
+
+> flip({floor: Math.floor, ceil: Math.ceil}, 1.5)
+{floor: 1, ceil: 2}
+
+> flip(Cons(Math.floor, Cons(Math.ceil, Nil)), 1.5)
+Cons(1, Cons(2, Nil))
+```
+
+#### `bimap :: Bifunctor f => (a -> b, c -> d, f a c) -> f b d`
Function wrapper for [`fantasy-land/bimap`][].
@@ -774,7 +794,7 @@ Function wrapper for [`fantasy-land/bimap`][].
Tuple('FOO', 8)
```
-
+#### `mapLeft :: Bifunctor f => (a -> b, f a c) -> f b c`
Maps the given function over the left side of a Bifunctor.
@@ -783,7 +803,7 @@ Maps the given function over the left side of a Bifunctor.
Tuple(8, 9)
```
-
+#### `promap :: Profunctor p => (a -> b, c -> d, p b c) -> p a d`
Function wrapper for [`fantasy-land/promap`][].
@@ -795,7 +815,7 @@ built-in types: Function.
11
```
-
+#### `ap :: Apply f => (f (a -> b), f a) -> f b`
Function wrapper for [`fantasy-land/ap`][].
@@ -819,7 +839,7 @@ Identity(8)
Cons(4, Cons(10, Cons(256, Cons(10000, Nil))))
```
-
+#### `lift2 :: Apply f => (a -> b -> c, f a, f b) -> f c`
Lifts `a -> b -> c` to `Apply f => f a -> f b -> f c` and returns the
result of applying this to the given arguments.
@@ -836,7 +856,7 @@ See also [`lift3`](#lift3).
Identity(1000)
```
-
+#### `lift3 :: Apply f => (a -> b -> c -> d, f a, f b, f c) -> f d`
Lifts `a -> b -> c -> d` to `Apply f => f a -> f b -> f c -> f d` and
returns the result of applying this to the given arguments.
@@ -853,7 +873,7 @@ See also [`lift2`](#lift2).
Identity('')
```
-
+#### `apFirst :: Apply f => (f a, f b) -> f a`
Combines two effectful actions, keeping only the result of the first.
Equivalent to Haskell's `(<*)` function.
@@ -870,7 +890,7 @@ See also [`apSecond`](#apSecond).
Identity(1)
```
-
+#### `apSecond :: Apply f => (f a, f b) -> f b`
Combines two effectful actions, keeping only the result of the second.
Equivalent to Haskell's `(*>)` function.
@@ -887,7 +907,7 @@ See also [`apFirst`](#apFirst).
Identity(2)
```
-
+#### `of :: Applicative f => (TypeRep f, a) -> f a`
Function wrapper for [`fantasy-land/of`][].
@@ -905,7 +925,7 @@ built-in types: Array and Function.
Cons(42, Nil)
```
-
+#### `append :: (Applicative f, Semigroup (f a)) => (a, f a) -> f a`
Returns the result of appending the first argument to the second.
@@ -921,7 +941,7 @@ See also [`prepend`](#prepend).
Cons(1, Cons(2, Cons(3, Nil)))
```
-
+#### `prepend :: (Applicative f, Semigroup (f a)) => (a, f a) -> f a`
Returns the result of prepending the first argument to the second.
@@ -937,7 +957,7 @@ See also [`append`](#append).
Cons(1, Cons(2, Cons(3, Nil)))
```
-
+#### `chain :: Chain m => (a -> m b, m a) -> m b`
Function wrapper for [`fantasy-land/chain`][].
@@ -955,7 +975,7 @@ Cons(1, Cons(3, Nil))
'Hask'
```
-
+#### `join :: Chain m => m (m a) -> m a`
Removes one level of nesting from a nested monadic structure.
@@ -972,7 +992,7 @@ This function is derived from [`chain`](#chain).
Identity(1)
```
-
+#### `chainRec :: ChainRec m => (TypeRep m, (a -> c, b -> c, a) -> m c, a) -> m b`
Function wrapper for [`fantasy-land/chainRec`][].
@@ -989,7 +1009,7 @@ built-in types: Array.
['oo!', 'oo?', 'on!', 'on?', 'no!', 'no?', 'nn!', 'nn?']
```
-
+#### `alt :: Alt f => (f a, f a) -> f a`
Function wrapper for [`fantasy-land/alt`][].
@@ -1010,7 +1030,7 @@ Just(1)
Just(2)
```
-
+#### `zero :: Plus f => TypeRep f -> f a`
Function wrapper for [`fantasy-land/zero`][].
@@ -1028,7 +1048,7 @@ built-in types: Array and Object.
Nothing
```
-
+#### `reduce :: Foldable f => ((b, a) -> b, b, f a) -> b`
Function wrapper for [`fantasy-land/reduce`][].
@@ -1043,7 +1063,7 @@ built-in types: Array and Object.
'foobarbaz'
```
-
+#### `size :: Foldable f => f a -> Integer`
Returns the number of elements of the given structure.
@@ -1063,7 +1083,7 @@ This function is derived from [`reduce`](#reduce).
3
```
-
+#### `elem :: (Setoid a, Foldable f) => (a, f a) -> Boolean`
Takes a value and a structure and returns `true` if the
value is an element of the structure; `false` otherwise.
@@ -1094,7 +1114,20 @@ false
false
```
-
+#### `foldMap :: (Monoid m, Foldable f) => (TypeRep m, a -> m, f a) -> m`
+
+Deconstructs a foldable by mapping every element to a monoid and
+concatenating the results.
+
+This function is derived from [`concat`](#concat), [`empty`](#empty),
+and [`reduce`](#reduce).
+
+```javascript
+> foldMap(String, f => f.name, [Math.sin, Math.cos, Math.tan])
+'sincostan'
+```
+
+#### `reverse :: (Applicative f, Foldable f, Monoid (f a)) => f a -> f a`
Reverses the elements of the given structure.
@@ -1109,7 +1142,7 @@ This function is derived from [`concat`](#concat), [`empty`](#empty),
Cons(3, Cons(2, Cons(1, Nil)))
```
-
+#### `sort :: (Ord a, Applicative f, Foldable f, Monoid (f a)) => f a -> f a`
Performs a [stable sort][] of the elements of the given structure,
using [`lte`](#lte) for comparisons.
@@ -1130,7 +1163,7 @@ See also [`sortBy`](#sortBy).
Cons('bar', Cons('baz', Cons('foo', Nil)))
```
-
+#### `sortBy :: (Ord b, Applicative f, Foldable f, Monoid (f a)) => (a -> b, f a) -> f a`
Performs a [stable sort][] of the elements of the given structure,
using [`lte`](#lte) to compare the values produced by applying the
@@ -1155,7 +1188,7 @@ See also [`sort`](#sort).
Cons('red', Cons('blue', Cons('green', Nil)))
```
-
+#### `traverse :: (Applicative f, Traversable t) => (TypeRep f, a -> f b, t a) -> f (t b)`
Function wrapper for [`fantasy-land/traverse`][].
@@ -1172,7 +1205,7 @@ See also [`sequence`](#sequence).
Identity([2, 3, 4])
```
-
+#### `sequence :: (Applicative f, Traversable t) => (TypeRep f, t (f a)) -> f (t a)`
Inverts the given `t (f a)` to produce an `f (t a)`.
@@ -1186,7 +1219,7 @@ This function is derived from [`traverse`](#traverse).
Identity([1, 2, 3])
```
-
+#### `extend :: Extend w => (w a -> b, w a) -> w b`
Function wrapper for [`fantasy-land/extend`][].
@@ -1201,7 +1234,7 @@ built-in types: Array and Function.
[4, 3, 2, 1]
```
-
+#### `duplicate :: Extend w => w a -> w (w a)`
Adds one level of nesting to a comonadic structure.
@@ -1221,7 +1254,7 @@ Identity(Identity(1))
[4, 3, 2, 1]
```
-
+#### `extract :: Comonad w => w a -> a`
Function wrapper for [`fantasy-land/extract`][].
@@ -1230,7 +1263,7 @@ Function wrapper for [`fantasy-land/extract`][].
42
```
-
+#### `contramap :: Contravariant f => (b -> a, f a) -> f b`
Function wrapper for [`fantasy-land/contramap`][].
diff --git a/index.js b/index.js
index 9cd3c3d..8f4971b 100644
--- a/index.js
+++ b/index.js
@@ -273,7 +273,7 @@
};
}
- var version = '8.1.1'; // updated programmatically
+ var version = '8.2.0'; // updated programmatically
var keys = Object.keys(requirements);
var typeClass = TypeClass(
diff --git a/package.json b/package.json
index a724005..5905599 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "sanctuary-type-classes",
- "version": "8.1.1",
+ "version": "8.2.0",
"description": "Standard library for Fantasy Land",
"license": "MIT",
"repository": {