diff --git a/README.md b/README.md index 12625d2..8c6dda8 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ This project provides: ## API -#### `TypeClass :: (String, String, Array TypeClass, a -⁠> Boolean) -⁠> TypeClass` +#### `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` +#### `Setoid :: TypeClass` `TypeClass` value for [Setoid][]. @@ -109,7 +109,7 @@ type-class constraints at run time. true ``` -#### `Ord :: TypeClass` +#### `Ord :: TypeClass` `TypeClass` value for [Ord][]. @@ -121,7 +121,7 @@ true false ``` -#### `Semigroupoid :: TypeClass` +#### `Semigroupoid :: TypeClass` `TypeClass` value for [Semigroupoid][]. @@ -133,7 +133,7 @@ true false ``` -#### `Category :: TypeClass` +#### `Category :: TypeClass` `TypeClass` value for [Category][]. @@ -145,7 +145,7 @@ true false ``` -#### `Semigroup :: TypeClass` +#### `Semigroup :: TypeClass` `TypeClass` value for [Semigroup][]. @@ -157,7 +157,7 @@ true false ``` -#### `Monoid :: TypeClass` +#### `Monoid :: TypeClass` `TypeClass` value for [Monoid][]. @@ -169,7 +169,7 @@ true false ``` -#### `Group :: TypeClass` +#### `Group :: TypeClass` `TypeClass` value for [Group][]. @@ -181,7 +181,7 @@ true false ``` -#### `Filterable :: TypeClass` +#### `Filterable :: TypeClass` `TypeClass` value for [Filterable][]. @@ -193,7 +193,7 @@ true false ``` -#### `Functor :: TypeClass` +#### `Functor :: TypeClass` `TypeClass` value for [Functor][]. @@ -205,7 +205,7 @@ true false ``` -#### `Bifunctor :: TypeClass` +#### `Bifunctor :: TypeClass` `TypeClass` value for [Bifunctor][]. @@ -217,7 +217,7 @@ true false ``` -#### `Profunctor :: TypeClass` +#### `Profunctor :: TypeClass` `TypeClass` value for [Profunctor][]. @@ -229,7 +229,7 @@ true false ``` -#### `Apply :: TypeClass` +#### `Apply :: TypeClass` `TypeClass` value for [Apply][]. @@ -241,7 +241,7 @@ true false ``` -#### `Applicative :: TypeClass` +#### `Applicative :: TypeClass` `TypeClass` value for [Applicative][]. @@ -253,7 +253,7 @@ true false ``` -#### `Chain :: TypeClass` +#### `Chain :: TypeClass` `TypeClass` value for [Chain][]. @@ -265,7 +265,7 @@ true false ``` -#### `ChainRec :: TypeClass` +#### `ChainRec :: TypeClass` `TypeClass` value for [ChainRec][]. @@ -277,7 +277,7 @@ true false ``` -#### `Monad :: TypeClass` +#### `Monad :: TypeClass` `TypeClass` value for [Monad][]. @@ -289,7 +289,7 @@ true false ``` -#### `Alt :: TypeClass` +#### `Alt :: TypeClass` `TypeClass` value for [Alt][]. @@ -301,7 +301,7 @@ true false ``` -#### `Plus :: TypeClass` +#### `Plus :: TypeClass` `TypeClass` value for [Plus][]. @@ -313,7 +313,7 @@ true false ``` -#### `Alternative :: TypeClass` +#### `Alternative :: TypeClass` `TypeClass` value for [Alternative][]. @@ -325,7 +325,7 @@ true false ``` -#### `Foldable :: TypeClass` +#### `Foldable :: TypeClass` `TypeClass` value for [Foldable][]. @@ -337,7 +337,7 @@ true false ``` -#### `Traversable :: TypeClass` +#### `Traversable :: TypeClass` `TypeClass` value for [Traversable][]. @@ -349,7 +349,7 @@ true false ``` -#### `Extend :: TypeClass` +#### `Extend :: TypeClass` `TypeClass` value for [Extend][]. @@ -361,7 +361,7 @@ true false ``` -#### `Comonad :: TypeClass` +#### `Comonad :: TypeClass` `TypeClass` value for [Comonad][]. @@ -373,7 +373,7 @@ true false ``` -#### `Contravariant :: TypeClass` +#### `Contravariant :: TypeClass` `TypeClass` value for [Contravariant][]. @@ -385,33 +385,7 @@ true false ``` -#### `toString :: a -⁠> String` - -Returns a useful string representation of its argument. - -Dispatches to the argument's `toString` method if appropriate. - -Where practical, `equals(eval(toString(x)), x) = true`. - -`toString` implementations are provided for the following built-in types: -Null, Undefined, Boolean, Number, Date, String, Array, Arguments, Error, -and Object. - -```javascript -> toString(-0) -'-0' - -> toString(['foo', 'bar', 'baz']) -'["foo", "bar", "baz"]' - -> toString({x: 1, y: 2, z: 3}) -'{"x": 1, "y": 2, "z": 3}' - -> toString(Cons(1, Cons(2, Cons(3, Nil)))) -'Cons(1, Cons(2, Cons(3, Nil)))' -``` - -#### `equals :: (a, b) -⁠> Boolean` +#### `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 +414,7 @@ true false ``` -#### `lt :: (a, b) -⁠> Boolean` +#### `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 +435,7 @@ true false ``` -#### `lte :: (a, b) -⁠> Boolean` +#### `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 +461,7 @@ true false ``` -#### `gt :: (a, b) -⁠> Boolean` +#### `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 +482,7 @@ false true ``` -#### `gte :: (a, b) -⁠> Boolean` +#### `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 +503,7 @@ false true ``` -#### `min :: Ord a => (a, a) -⁠> a` +#### `min :: Ord a => (a, a) -⁠> a` Returns the smaller of its two arguments. @@ -548,7 +522,7 @@ new Date('1999-12-31') '10' ``` -#### `max :: Ord a => (a, a) -⁠> a` +#### `max :: Ord a => (a, a) -⁠> a` Returns the larger of its two arguments. @@ -567,7 +541,7 @@ new Date('2000-01-01') '2' ``` -#### `compose :: Semigroupoid c => (c j k, c i j) -⁠> c i k` +#### `compose :: Semigroupoid c => (c j k, c i j) -⁠> c i k` Function wrapper for [`fantasy-land/compose`][]. @@ -579,7 +553,7 @@ built-in types: Function. 10 ``` -#### `id :: Category c => TypeRep c -⁠> c` +#### `id :: Category c => TypeRep c -⁠> c` Function wrapper for [`fantasy-land/id`][]. @@ -591,7 +565,7 @@ built-in types: Function. 'foo' ``` -#### `concat :: Semigroup a => (a, a) -⁠> a` +#### `concat :: Semigroup a => (a, a) -⁠> a` Function wrapper for [`fantasy-land/concat`][]. @@ -612,7 +586,7 @@ built-in types: String, Array, and Object. Cons('foo', Cons('bar', Cons('baz', Cons('quux', Nil)))) ``` -#### `empty :: Monoid m => TypeRep m -⁠> m` +#### `empty :: Monoid m => TypeRep m -⁠> m` Function wrapper for [`fantasy-land/empty`][]. @@ -633,7 +607,7 @@ built-in types: String, Array, and Object. Nil ``` -#### `invert :: Group g => g -⁠> g` +#### `invert :: Group g => g -⁠> g` Function wrapper for [`fantasy-land/invert`][]. @@ -642,7 +616,7 @@ Function wrapper for [`fantasy-land/invert`][]. Sum(-5) ``` -#### `filter :: Filterable f => (a -⁠> Boolean, f a) -⁠> f a` +#### `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 +646,7 @@ Nothing Just(1) ``` -#### `reject :: Filterable f => (a -⁠> Boolean, f a) -⁠> f a` +#### `reject :: Filterable f => (a -⁠> Boolean, f a) -⁠> f a` Discards every element which satisfies the predicate. @@ -698,7 +672,7 @@ Just(0) Nothing ``` -#### `takeWhile :: Filterable f => (a -⁠> Boolean, f a) -⁠> f a` +#### `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 +692,7 @@ See also [`dropWhile`](#dropWhile). [] ``` -#### `dropWhile :: Filterable f => (a -⁠> Boolean, f a) -⁠> f a` +#### `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 +712,7 @@ See also [`takeWhile`](#takeWhile). ['xy', 'xz', 'yx', 'yz', 'zx', 'zy'] ``` -#### `map :: Functor f => (a -⁠> b, f a) -⁠> f b` +#### `map :: Functor f => (a -⁠> b, f a) -⁠> f b` Function wrapper for [`fantasy-land/map`][]. @@ -765,7 +739,7 @@ Nil Cons(1, Cons(2, Cons(3, Nil))) ``` -#### `flip :: Functor f => (f (a -⁠> b), a) -⁠> f b` +#### `flip :: Functor f => (f (a -⁠> b), a) -⁠> f b` Maps over the given functions, applying each to the given value. @@ -785,7 +759,7 @@ This function is derived from [`map`](#map). Cons(1, Cons(2, Nil)) ``` -#### `bimap :: Bifunctor f => (a -⁠> b, c -⁠> d, f a c) -⁠> f b d` +#### `bimap :: Bifunctor f => (a -⁠> b, c -⁠> d, f a c) -⁠> f b d` Function wrapper for [`fantasy-land/bimap`][]. @@ -794,7 +768,7 @@ Function wrapper for [`fantasy-land/bimap`][]. Tuple('FOO', 8) ``` -#### `mapLeft :: Bifunctor f => (a -⁠> b, f a c) -⁠> f b c` +#### `mapLeft :: Bifunctor f => (a -⁠> b, f a c) -⁠> f b c` Maps the given function over the left side of a Bifunctor. @@ -803,7 +777,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` +#### `promap :: Profunctor p => (a -⁠> b, c -⁠> d, p b c) -⁠> p a d` Function wrapper for [`fantasy-land/promap`][]. @@ -815,7 +789,7 @@ built-in types: Function. 11 ``` -#### `ap :: Apply f => (f (a -⁠> b), f a) -⁠> f b` +#### `ap :: Apply f => (f (a -⁠> b), f a) -⁠> f b` Function wrapper for [`fantasy-land/ap`][]. @@ -839,7 +813,7 @@ Identity(8) Cons(4, Cons(10, Cons(256, Cons(10000, Nil)))) ``` -#### `lift2 :: Apply f => (a -⁠> b -⁠> c, f a, f b) -⁠> f c` +#### `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. @@ -856,7 +830,7 @@ See also [`lift3`](#lift3). Identity(1000) ``` -#### `lift3 :: Apply f => (a -⁠> b -⁠> c -⁠> d, f a, f b, f c) -⁠> f d` +#### `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. @@ -873,7 +847,7 @@ See also [`lift2`](#lift2). Identity('') ``` -#### `apFirst :: Apply f => (f a, f b) -⁠> f a` +#### `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. @@ -890,7 +864,7 @@ See also [`apSecond`](#apSecond). Identity(1) ``` -#### `apSecond :: Apply f => (f a, f b) -⁠> f b` +#### `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. @@ -907,7 +881,7 @@ See also [`apFirst`](#apFirst). Identity(2) ``` -#### `of :: Applicative f => (TypeRep f, a) -⁠> f a` +#### `of :: Applicative f => (TypeRep f, a) -⁠> f a` Function wrapper for [`fantasy-land/of`][]. @@ -925,7 +899,7 @@ built-in types: Array and Function. Cons(42, Nil) ``` -#### `append :: (Applicative f, Semigroup (f a)) => (a, f a) -⁠> f a` +#### `append :: (Applicative f, Semigroup (f a)) => (a, f a) -⁠> f a` Returns the result of appending the first argument to the second. @@ -941,7 +915,7 @@ See also [`prepend`](#prepend). Cons(1, Cons(2, Cons(3, Nil))) ``` -#### `prepend :: (Applicative f, Semigroup (f a)) => (a, f a) -⁠> f a` +#### `prepend :: (Applicative f, Semigroup (f a)) => (a, f a) -⁠> f a` Returns the result of prepending the first argument to the second. @@ -957,7 +931,7 @@ See also [`append`](#append). Cons(1, Cons(2, Cons(3, Nil))) ``` -#### `chain :: Chain m => (a -⁠> m b, m a) -⁠> m b` +#### `chain :: Chain m => (a -⁠> m b, m a) -⁠> m b` Function wrapper for [`fantasy-land/chain`][]. @@ -975,7 +949,7 @@ Cons(1, Cons(3, Nil)) 'Hask' ``` -#### `join :: Chain m => m (m a) -⁠> m a` +#### `join :: Chain m => m (m a) -⁠> m a` Removes one level of nesting from a nested monadic structure. @@ -992,7 +966,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` +#### `chainRec :: ChainRec m => (TypeRep m, (a -⁠> c, b -⁠> c, a) -⁠> m c, a) -⁠> m b` Function wrapper for [`fantasy-land/chainRec`][]. @@ -1009,7 +983,7 @@ built-in types: Array. ['oo!', 'oo?', 'on!', 'on?', 'no!', 'no?', 'nn!', 'nn?'] ``` -#### `alt :: Alt f => (f a, f a) -⁠> f a` +#### `alt :: Alt f => (f a, f a) -⁠> f a` Function wrapper for [`fantasy-land/alt`][]. @@ -1030,7 +1004,7 @@ Just(1) Just(2) ``` -#### `zero :: Plus f => TypeRep f -⁠> f a` +#### `zero :: Plus f => TypeRep f -⁠> f a` Function wrapper for [`fantasy-land/zero`][]. @@ -1048,7 +1022,7 @@ built-in types: Array and Object. Nothing ``` -#### `reduce :: Foldable f => ((b, a) -⁠> b, b, f a) -⁠> b` +#### `reduce :: Foldable f => ((b, a) -⁠> b, b, f a) -⁠> b` Function wrapper for [`fantasy-land/reduce`][]. @@ -1063,7 +1037,7 @@ built-in types: Array and Object. 'foobarbaz' ``` -#### `size :: Foldable f => f a -⁠> Integer` +#### `size :: Foldable f => f a -⁠> Integer` Returns the number of elements of the given structure. @@ -1083,7 +1057,7 @@ This function is derived from [`reduce`](#reduce). 3 ``` -#### `elem :: (Setoid a, Foldable f) => (a, f a) -⁠> Boolean` +#### `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. @@ -1114,7 +1088,7 @@ false false ``` -#### `foldMap :: (Monoid m, Foldable f) => (TypeRep m, a -⁠> m, f a) -⁠> m` +#### `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. @@ -1127,7 +1101,7 @@ and [`reduce`](#reduce). 'sincostan' ``` -#### `reverse :: (Applicative f, Foldable f, Monoid (f a)) => f a -⁠> f a` +#### `reverse :: (Applicative f, Foldable f, Monoid (f a)) => f a -⁠> f a` Reverses the elements of the given structure. @@ -1142,7 +1116,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` +#### `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. @@ -1163,7 +1137,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` +#### `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 @@ -1188,7 +1162,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)` +#### `traverse :: (Applicative f, Traversable t) => (TypeRep f, a -⁠> f b, t a) -⁠> f (t b)` Function wrapper for [`fantasy-land/traverse`][]. @@ -1205,7 +1179,7 @@ See also [`sequence`](#sequence). Identity([2, 3, 4]) ``` -#### `sequence :: (Applicative f, Traversable t) => (TypeRep f, t (f a)) -⁠> f (t a)` +#### `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)`. @@ -1219,7 +1193,7 @@ This function is derived from [`traverse`](#traverse). Identity([1, 2, 3]) ``` -#### `extend :: Extend w => (w a -⁠> b, w a) -⁠> w b` +#### `extend :: Extend w => (w a -⁠> b, w a) -⁠> w b` Function wrapper for [`fantasy-land/extend`][]. @@ -1234,7 +1208,7 @@ built-in types: Array and Function. [4, 3, 2, 1] ``` -#### `duplicate :: Extend w => w a -⁠> w (w a)` +#### `duplicate :: Extend w => w a -⁠> w (w a)` Adds one level of nesting to a comonadic structure. @@ -1254,7 +1228,7 @@ Identity(Identity(1)) [4, 3, 2, 1] ``` -#### `extract :: Comonad w => w a -⁠> a` +#### `extract :: Comonad w => w a -⁠> a` Function wrapper for [`fantasy-land/extract`][]. @@ -1263,7 +1237,7 @@ Function wrapper for [`fantasy-land/extract`][]. 42 ``` -#### `contramap :: Contravariant f => (b -⁠> a, f a) -⁠> f b` +#### `contramap :: Contravariant f => (b -⁠> a, f a) -⁠> f b` Function wrapper for [`fantasy-land/contramap`][]. diff --git a/index.js b/index.js index 8960bbf..076b3dd 100644 --- a/index.js +++ b/index.js @@ -273,7 +273,7 @@ }; } - var version = '8.2.1'; // updated programmatically + var version = '9.0.0'; // updated programmatically var keys = Object.keys(requirements); var typeClass = TypeClass( diff --git a/package.json b/package.json index ba75eec..3182cfa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sanctuary-type-classes", - "version": "8.2.1", + "version": "9.0.0", "description": "Standard library for Fantasy Land", "license": "MIT", "repository": {