From b0c871d6649cb374e8ec47257ad502ad60cfa8b8 Mon Sep 17 00:00:00 2001 From: David Chambers Date: Thu, 4 Jan 2018 18:18:18 +0100 Subject: [PATCH] Version 7.2.0 --- LICENSE | 2 +- README.md | 163 ++++++++++++++++++++++++++++---------------------- index.js | 2 +- package.json | 2 +- test/index.js | 2 +- 5 files changed, 97 insertions(+), 74 deletions(-) diff --git a/LICENSE b/LICENSE index e3450c5..1a41c06 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2017 Sanctuary +Copyright (c) 2018 Sanctuary Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/README.md b/README.md index c7f08d8..7caf1ab 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 ``` -

Functor :: TypeClass

+

Functor :: TypeClass

`TypeClass` value for [Functor][]. @@ -193,7 +193,7 @@ true false ``` -

Bifunctor :: TypeClass

+

Bifunctor :: TypeClass

`TypeClass` value for [Bifunctor][]. @@ -205,7 +205,7 @@ true false ``` -

Profunctor :: TypeClass

+

Profunctor :: TypeClass

`TypeClass` value for [Profunctor][]. @@ -217,7 +217,7 @@ true false ``` -

Apply :: TypeClass

+

Apply :: TypeClass

`TypeClass` value for [Apply][]. @@ -229,7 +229,7 @@ true false ``` -

Applicative :: TypeClass

+

Applicative :: TypeClass

`TypeClass` value for [Applicative][]. @@ -241,7 +241,7 @@ true false ``` -

Chain :: TypeClass

+

Chain :: TypeClass

`TypeClass` value for [Chain][]. @@ -253,7 +253,7 @@ true false ``` -

ChainRec :: TypeClass

+

ChainRec :: TypeClass

`TypeClass` value for [ChainRec][]. @@ -265,7 +265,7 @@ true false ``` -

Monad :: TypeClass

+

Monad :: TypeClass

`TypeClass` value for [Monad][]. @@ -277,7 +277,7 @@ true false ``` -

Alt :: TypeClass

+

Alt :: TypeClass

`TypeClass` value for [Alt][]. @@ -289,7 +289,7 @@ true false ``` -

Plus :: TypeClass

+

Plus :: TypeClass

`TypeClass` value for [Plus][]. @@ -301,7 +301,7 @@ true false ``` -

Alternative :: TypeClass

+

Alternative :: TypeClass

`TypeClass` value for [Alternative][]. @@ -313,7 +313,7 @@ true false ``` -

Foldable :: TypeClass

+

Foldable :: TypeClass

`TypeClass` value for [Foldable][]. @@ -325,7 +325,7 @@ true false ``` -

Traversable :: TypeClass

+

Traversable :: TypeClass

`TypeClass` value for [Traversable][]. @@ -337,7 +337,7 @@ true false ``` -

Extend :: TypeClass

+

Extend :: TypeClass

`TypeClass` value for [Extend][]. @@ -349,7 +349,7 @@ true false ``` -

Comonad :: TypeClass

+

Comonad :: TypeClass

`TypeClass` value for [Comonad][]. @@ -361,7 +361,7 @@ true false ``` -

Contravariant :: TypeClass

+

Contravariant :: TypeClass

`TypeClass` value for [Contravariant][]. @@ -373,7 +373,7 @@ true false ``` -

toString :: a -> String

+

toString :: a -> String

Returns a useful string representation of its argument. @@ -399,7 +399,7 @@ and Object. '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. @@ -428,7 +428,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`][] @@ -449,7 +449,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 @@ -475,7 +475,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`][] @@ -496,7 +496,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 @@ -517,7 +517,7 @@ false true ``` -

min :: Ord a => (a, a) -> a

+

min :: Ord a => (a, a) -> a

Returns the smaller of its two arguments. @@ -536,7 +536,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. @@ -555,7 +555,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`][]. @@ -567,7 +567,7 @@ built-in types: Function. 10 ``` -

id :: Category c => TypeRep c -> c

+

id :: Category c => TypeRep c -> c

Function wrapper for [`fantasy-land/id`][]. @@ -579,7 +579,7 @@ built-in types: Function. 'foo' ``` -

concat :: Semigroup a => (a, a) -> a

+

concat :: Semigroup a => (a, a) -> a

Function wrapper for [`fantasy-land/concat`][]. @@ -600,7 +600,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`][]. @@ -621,16 +621,16 @@ built-in types: String, Array, and Object. Nil ``` -

invert :: Group g => g -> g

+

invert :: Group g => g -> g

Function wrapper for [`fantasy-land/invert`][]. ```javascript -invert(Sum(5)) +> invert(Sum(5)) Sum(-5) ``` -

map :: Functor f => (a -> b, f a) -> f b

+

map :: Functor f => (a -> b, f a) -> f b

Function wrapper for [`fantasy-land/map`][]. @@ -657,7 +657,7 @@ Nil Cons(1, Cons(2, Cons(3, 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`][]. @@ -666,7 +666,7 @@ Function wrapper for [`fantasy-land/bimap`][]. Tuple('FOO', 8) ``` -

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`][]. @@ -678,7 +678,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`][]. @@ -702,7 +702,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. @@ -719,7 +719,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. @@ -736,7 +736,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. @@ -753,7 +753,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. @@ -770,7 +770,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`][]. @@ -788,7 +788,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. @@ -804,7 +804,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. @@ -820,7 +820,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`][]. @@ -838,7 +838,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. @@ -855,7 +855,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`][]. @@ -872,7 +872,7 @@ built-in types: Array. ['oo!', 'oo?', 'on!', 'on?', 'no!', 'no?', 'nn!', 'nn?'] ``` -

filter :: (Applicative f, Foldable f, Monoid (f a)) => (a -> Boolean, f a) -> f a

+

filter :: (Applicative f, Foldable f, Monoid (f a)) => (a -> Boolean, f a) -> f a

Filters its second argument in accordance with the given predicate. @@ -889,7 +889,7 @@ See also [`filterM`](#filterM). Cons(1, Cons(3, Nil)) ``` -

filterM :: (Alternative m, Monad m) => (a -> Boolean, m a) -> m a

+

filterM :: (Alternative m, Monad m) => (a -> Boolean, m a) -> m a

Filters its second argument in accordance with the given predicate. @@ -915,7 +915,7 @@ Nothing Just(1) ``` -

alt :: Alt f => (f a, f a) -> f a

+

alt :: Alt f => (f a, f a) -> f a

Function wrapper for [`fantasy-land/alt`][]. @@ -936,7 +936,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`][]. @@ -954,7 +954,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`][]. @@ -969,7 +969,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. @@ -989,7 +989,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. @@ -1020,7 +1020,7 @@ false false ``` -

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. @@ -1035,7 +1035,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. @@ -1056,7 +1056,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 @@ -1081,7 +1081,7 @@ See also [`sort`](#sort). Cons('red', Cons('blue', Cons('green', Nil))) ``` -

takeWhile :: (Applicative f, Foldable f, Monoid (f a)) => (a -> Boolean, f a) -> f a

+

takeWhile :: (Applicative f, Foldable f, Monoid (f a)) => (a -> Boolean, f a) -> f a

Discards the first inner value which does not satisfy the predicate, and all subsequent inner values. @@ -1102,7 +1102,7 @@ See also [`dropWhile`](#dropWhile). [] ``` -

dropWhile :: (Applicative f, Foldable f, Monoid (f a)) => (a -> Boolean, f a) -> f a

+

dropWhile :: (Applicative f, Foldable f, Monoid (f a)) => (a -> Boolean, f a) -> f a

Retains the first inner value which does not satisfy the predicate, and all subsequent inner values. @@ -1123,7 +1123,7 @@ See also [`takeWhile`](#takeWhile). ['xy', 'xz', 'yx', 'yz', 'zx', 'zy'] ``` -

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`][]. @@ -1140,7 +1140,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)`. @@ -1154,19 +1154,42 @@ 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`][]. `fantasy-land/extend` implementations are provided for the following -built-in types: Array. +built-in types: Array and Function. ```javascript > extend(ss => ss.join(''), ['x', 'y', 'z']) ['xyz', 'yz', 'z'] + +> extend(f => f([3, 4]), reverse)([1, 2]) +[4, 3, 2, 1] +``` + +

duplicate :: Extend w => w a -> w (w a)

+ +Adds one level of nesting to a comonadic structure. + +This function is derived from [`extend`](#extend). + +```javascript +> duplicate(Identity(1)) +Identity(Identity(1)) + +> duplicate([1]) +[[1]] + +> duplicate([1, 2, 3]) +[[1, 2, 3], [2, 3], [3]] + +> duplicate(reverse)([1, 2])([3, 4]) +[4, 3, 2, 1] ``` -

extract :: Comonad w => w a -> a

+

extract :: Comonad w => w a -> a

Function wrapper for [`fantasy-land/extract`][]. @@ -1175,7 +1198,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 254993f..c18ee71 100644 --- a/index.js +++ b/index.js @@ -251,7 +251,7 @@ }; } - var version = '7.1.1'; // updated programmatically + var version = '7.2.0'; // updated programmatically var keys = Object.keys(requirements); var typeClass = TypeClass( diff --git a/package.json b/package.json index dee89d0..9a9e93c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sanctuary-type-classes", - "version": "7.1.1", + "version": "7.2.0", "description": "Standard library for Fantasy Land", "license": "MIT", "repository": { diff --git a/test/index.js b/test/index.js index dffa886..77b5796 100644 --- a/test/index.js +++ b/test/index.js @@ -158,7 +158,7 @@ function toUpper(s) { } // version :: String -var version = '7.1.1'; // updated programmatically +var version = '7.2.0'; // updated programmatically // wrap :: String -> String -> String -> String function wrap(before) {