From d9d267ebe70cce4bd02c2c8e785253dfd637147d Mon Sep 17 00:00:00 2001 From: David Chambers Date: Sun, 23 Oct 2016 01:56:32 +0200 Subject: [PATCH] Version 0.2.0 --- README.md | 102 ++++++++++++++++++++++++++++++++++----------------- package.json | 2 +- 2 files changed, 69 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 69d9427..84be9ad 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ This project provides: ## API -

TypeClass :: (String, Array TypeClass, a -> Boolean) -> TypeClass

+

TypeClass :: (String, Array TypeClass, a -> Boolean) -> TypeClass

The arguments are: @@ -86,7 +86,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][]. @@ -95,7 +95,7 @@ type-class constraints at run time. true ``` -

Semigroup :: TypeClass

+

Semigroup :: TypeClass

`TypeClass` value for [Semigroup][]. @@ -107,7 +107,7 @@ true false ``` -

Monoid :: TypeClass

+

Monoid :: TypeClass

`TypeClass` value for [Monoid][]. @@ -119,7 +119,7 @@ true false ``` -

Functor :: TypeClass

+

Functor :: TypeClass

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

Bifunctor :: TypeClass

+

Bifunctor :: TypeClass

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

Profunctor :: TypeClass

+

Profunctor :: TypeClass

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

Apply :: TypeClass

+

Apply :: TypeClass

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

Applicative :: TypeClass

+

Applicative :: TypeClass

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

Chain :: TypeClass

+

Chain :: TypeClass

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

ChainRec :: TypeClass

+

ChainRec :: TypeClass

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

Monad :: TypeClass

+

Monad :: TypeClass

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

Foldable :: TypeClass

+

Foldable :: TypeClass

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

Traversable :: TypeClass

+

Traversable :: TypeClass

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

Extend :: TypeClass

+

Extend :: TypeClass

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

Comonad :: TypeClass

+

Comonad :: TypeClass

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

toString :: a -> String

+

toString :: a -> String

Returns a useful string representation of its argument. @@ -289,7 +289,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. @@ -312,7 +312,7 @@ true false ``` -

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

+

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

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

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

+

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

Function wrapper for [`fantasy-land/map`][]. @@ -381,7 +381,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`][]. @@ -390,7 +390,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`][]. @@ -402,7 +402,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`][]. @@ -423,7 +423,41 @@ Identity(8) Cons(4, Cons(10, Cons(256, Cons(10000, Nil)))) ``` -

of :: Applicative f => (TypeRep f, a) -> f a

+

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. + +This function is derived from [`map`](#map) and [`ap`](#ap). + +See also [`lift3`](#lift3). + +```javascript +> lift2(x => y => Math.pow(x, y), [10], [1, 2, 3]) +[10, 100, 1000] + +> lift2(x => y => Math.pow(x, y), Identity(10), Identity(3)) +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. + +This function is derived from [`map`](#map) and [`ap`](#ap). + +See also [`lift2`](#lift2). + +```javascript +> lift3(x => y => z => x + z + y, ['<'], ['>'], ['foo', 'bar', 'baz']) +['', '', ''] + +> lift3(x => y => z => x + z + y, Identity('<'), Identity('>'), Identity('baz')) +Identity('') +``` + +

of :: Applicative f => (TypeRep f, a) -> f a

Function wrapper for [`fantasy-land/of`][]. @@ -441,7 +475,7 @@ built-in types: Array and Function. Cons(42, 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`][]. @@ -459,7 +493,7 @@ Cons(1, Cons(3, Nil)) 'Hask' ``` -

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`][]. @@ -476,7 +510,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. @@ -493,7 +527,7 @@ See also [`filterM`](#filterM). Cons(1, Cons(3, Nil)) ``` -

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

+

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

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

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`][]. @@ -525,7 +559,7 @@ built-in types: Array and Object. 'foobarbaz' ``` -

traverse :: (Applicative f, Traversable t) => (a -> f a, b -> f c, t b) -> f (t c)

+

traverse :: (Applicative f, Traversable t) => (a -> f a, b -> f c, t b) -> f (t c)

Function wrapper for [`fantasy-land/traverse`][]. @@ -542,7 +576,7 @@ See also [`sequence`](#sequence). Identity([2, 3, 4]) ``` -

sequence :: (Applicative f, Traversable t) => (a -> f a, t (f b)) -> f (t b)

+

sequence :: (Applicative f, Traversable t) => (a -> f a, t (f b)) -> f (t b)

Inverts the given `t (f b)` to produce an `f (t b)`. @@ -556,7 +590,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`][]. @@ -568,7 +602,7 @@ built-in types: Array. [4] ``` -

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

+

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

Function wrapper for [`fantasy-land/extract`][]. diff --git a/package.json b/package.json index 7b0e45f..9c117a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sanctuary-type-classes", - "version": "0.1.0", + "version": "0.2.0", "description": "Standard library for Fantasy Land", "license": "MIT", "repository": {