From 8da80e08ecb173525906202cd5e53f6d7440a755 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 27 Oct 2020 08:32:19 +0100 Subject: [PATCH] add "Derivable from" comments --- docs/modules/Array.ts.md | 154 ++++++++++--------- docs/modules/Either.ts.md | 186 ++++++++++++----------- docs/modules/IO.ts.md | 73 +++++---- docs/modules/IOEither.ts.md | 136 +++++++++-------- docs/modules/Identity.ts.md | 87 ++++++----- docs/modules/NonEmptyArray.ts.md | 98 ++++++------ docs/modules/Option.ts.md | 134 ++++++++-------- docs/modules/Reader.ts.md | 98 ++++++------ docs/modules/ReaderEither.ts.md | 138 +++++++++-------- docs/modules/ReaderTask.ts.md | 92 ++++++----- docs/modules/ReaderTaskEither.ts.md | 158 ++++++++++--------- docs/modules/ReadonlyArray.ts.md | 154 ++++++++++--------- docs/modules/ReadonlyNonEmptyArray.ts.md | 98 ++++++------ docs/modules/ReadonlyTuple.ts.md | 24 +-- docs/modules/State.ts.md | 45 +++--- docs/modules/StateReaderTaskEither.ts.md | 158 ++++++++++--------- docs/modules/Store.ts.md | 27 ++-- docs/modules/Task.ts.md | 88 ++++++----- docs/modules/TaskEither.ts.md | 144 ++++++++++-------- docs/modules/Tree.ts.md | 87 ++++++----- docs/modules/Tuple.ts.md | 24 +-- src/Array.ts | 22 ++- src/Either.ts | 24 ++- src/IO.ts | 16 +- src/IOEither.ts | 22 ++- src/Identity.ts | 20 ++- src/NonEmptyArray.ts | 20 ++- src/Option.ts | 20 ++- src/Reader.ts | 16 +- src/ReaderEither.ts | 20 ++- src/ReaderTask.ts | 16 +- src/ReaderTaskEither.ts | 22 ++- src/ReadonlyArray.ts | 20 ++- src/ReadonlyNonEmptyArray.ts | 20 ++- src/ReadonlyTuple.ts | 4 +- src/State.ts | 16 +- src/StateReaderTaskEither.ts | 20 ++- src/Store.ts | 4 +- src/Task.ts | 16 +- src/TaskEither.ts | 22 ++- src/Tree.ts | 20 ++- src/Tuple.ts | 4 +- 42 files changed, 1475 insertions(+), 1092 deletions(-) diff --git a/docs/modules/Array.ts.md b/docs/modules/Array.ts.md index 36fd0b7ae..31c573338 100644 --- a/docs/modules/Array.ts.md +++ b/docs/modules/Array.ts.md @@ -20,13 +20,10 @@ Added in v2.0.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [Compactable](#compactable) - [compact](#compact) - [separate](#separate) - [Extend](#extend) - - [duplicate](#duplicate) - [extend](#extend) - [Filterable](#filterable) - [filter](#filter) @@ -52,8 +49,6 @@ Added in v2.0.0 - [mapWithIndex](#mapwithindex) - [Monad](#monad) - [chain](#chain) - - [chainFirst](#chainfirst) - - [flatten](#flatten) - [Traversable](#traversable) - [sequence](#sequence) - [traverse](#traverse) @@ -65,12 +60,17 @@ Added in v2.0.0 - [wilt](#wilt) - [wither](#wither) - [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) + - [chainFirst](#chainfirst) - [chop](#chop) - [copy](#copy) - [difference](#difference) - [dropLeft](#dropleft) - [dropLeftWhile](#dropleftwhile) - [dropRight](#dropright) + - [duplicate](#duplicate) + - [flatten](#flatten) - [intersection](#intersection) - [lefts](#lefts) - [reverse](#reverse) @@ -213,30 +213,6 @@ export declare const ap: (fa: A[]) => (fab: ((a: A) => B)[]) => B[] Added in v2.0.0 -## apFirst - -Combine two effectful actions, keeping only the result of the first. - -**Signature** - -```ts -export declare const apFirst: (fb: B[]) => (fa: A[]) => A[] -``` - -Added in v2.0.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: (fb: B[]) => (fa: A[]) => B[] -``` - -Added in v2.0.0 - # Compactable ## compact @@ -261,16 +237,6 @@ Added in v2.0.0 # Extend -## duplicate - -**Signature** - -```ts -export declare const duplicate: (wa: A[]) => A[][] -``` - -Added in v2.0.0 - ## extend **Signature** @@ -484,39 +450,6 @@ export declare const chain: (f: (a: A) => B[]) => (ma: A[]) => B[] Added in v2.0.0 -## chainFirst - -Composes computations in sequence, using the return value of one computation to determine the next computation and -keeping only the result of the first. - -**Signature** - -```ts -export declare const chainFirst: (f: (a: A) => B[]) => (ma: A[]) => A[] -``` - -Added in v2.0.0 - -## flatten - -Removes one level of nesting - -**Signature** - -```ts -export declare const flatten: (mma: A[][]) => A[] -``` - -**Example** - -```ts -import { flatten } from 'fp-ts/Array' - -assert.deepStrictEqual(flatten([[1], [2], [3]]), [1, 2, 3]) -``` - -Added in v2.0.0 - # Traversable ## sequence @@ -587,6 +520,49 @@ Added in v2.6.5 # combinators +## apFirst + +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apFirst: (fb: B[]) => (fa: A[]) => A[] +``` + +Added in v2.0.0 + +## apSecond + +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apSecond: (fb: B[]) => (fa: A[]) => B[] +``` + +Added in v2.0.0 + +## chainFirst + +Composes computations in sequence, using the return value of one computation to determine the next computation and +keeping only the result of the first. + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirst: (f: (a: A) => B[]) => (ma: A[]) => A[] +``` + +Added in v2.0.0 + ## chop A useful recursion pattern for processing an array to produce a new array, often used for "chopping" up the input @@ -709,6 +685,40 @@ assert.deepStrictEqual(dropRight(2)([1, 2, 3, 4, 5]), [1, 2, 3]) Added in v2.0.0 +## duplicate + +Derivable from `Extend`. + +**Signature** + +```ts +export declare const duplicate: (wa: A[]) => A[][] +``` + +Added in v2.0.0 + +## flatten + +Removes one level of nesting. + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const flatten: (mma: A[][]) => A[] +``` + +**Example** + +```ts +import { flatten } from 'fp-ts/Array' + +assert.deepStrictEqual(flatten([[1], [2], [3]]), [1, 2, 3]) +``` + +Added in v2.0.0 + ## intersection Creates an array of unique values that are included in all given arrays using a `Eq` for equality diff --git a/docs/modules/Either.ts.md b/docs/modules/Either.ts.md index 5cb05660a..719c603a7 100644 --- a/docs/modules/Either.ts.md +++ b/docs/modules/Either.ts.md @@ -30,14 +30,11 @@ Added in v2.0.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [apW](#apw) - [Bifunctor](#bifunctor) - [bimap](#bimap) - [mapLeft](#mapleft) - [Extend](#extend) - - [duplicate](#duplicate) - [extend](#extend) - [Foldable](#foldable) - [foldMap](#foldmap) @@ -47,17 +44,20 @@ Added in v2.0.0 - [map](#map) - [Monad](#monad) - [chain](#chain) - - [chainFirst](#chainfirst) - - [chainFirstW](#chainfirstw) - [chainW](#chainw) - - [flatten](#flatten) - [MonadThrow](#monadthrow) - [throwError](#throwerror) - [Traversable](#traversable) - [sequence](#sequence) - [traverse](#traverse) - [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) + - [chainFirst](#chainfirst) + - [chainFirstW](#chainfirstw) + - [duplicate](#duplicate) - [filterOrElse](#filterorelse) + - [flatten](#flatten) - [orElse](#orelse) - [swap](#swap) - [constructors](#constructors) @@ -174,30 +174,6 @@ export declare const ap: (fa: Either) => (fab: Either(fb: Either) => (fa: Either) => Either -``` - -Added in v2.0.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: (fb: Either) => (fa: Either) => Either -``` - -Added in v2.0.0 - ## apW Less strict version of [`ap`](#ap). @@ -238,16 +214,6 @@ Added in v2.0.0 # Extend -## duplicate - -**Signature** - -```ts -export declare const duplicate: (ma: Either) => Either> -``` - -Added in v2.0.0 - ## extend **Signature** @@ -367,31 +333,6 @@ export declare const chain: (f: (a: A) => Either) => (ma: Either< Added in v2.0.0 -## chainFirst - -Composes computations in sequence, using the return value of one computation to determine the next computation and -keeping only the result of the first. - -**Signature** - -```ts -export declare const chainFirst: (f: (a: A) => Either) => (ma: Either) => Either -``` - -Added in v2.0.0 - -## chainFirstW - -Less strict version of [`chainFirst`](#chainFirst) - -**Signature** - -```ts -export declare const chainFirstW: (f: (a: A) => Either) => (ma: Either) => Either -``` - -Added in v2.8.0 - ## chainW Less strict version of [`chain`](#chain). @@ -404,28 +345,6 @@ export declare const chainW: (f: (a: A) => Either) => (ma: Eit Added in v2.6.0 -## flatten - -The `flatten` function is the conventional monad join operator. It is used to remove one level of monadic structure, projecting its bound argument into the outer level. - -**Signature** - -```ts -export declare const flatten: (mma: Either>) => Either -``` - -**Example** - -```ts -import * as E from 'fp-ts/Either' - -assert.deepStrictEqual(E.flatten(E.right(E.right('a'))), E.right('a')) -assert.deepStrictEqual(E.flatten(E.right(E.left('e'))), E.left('e')) -assert.deepStrictEqual(E.flatten(E.left('e')), E.left('e')) -``` - -Added in v2.0.0 - # MonadThrow ## throwError @@ -491,6 +410,75 @@ Added in v2.6.3 # combinators +## apFirst + +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apFirst: (fb: Either) => (fa: Either) => Either +``` + +Added in v2.0.0 + +## apSecond + +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apSecond: (fb: Either) => (fa: Either) => Either +``` + +Added in v2.0.0 + +## chainFirst + +Composes computations in sequence, using the return value of one computation to determine the next computation and +keeping only the result of the first. + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirst: (f: (a: A) => Either) => (ma: Either) => Either +``` + +Added in v2.0.0 + +## chainFirstW + +Less strict version of [`chainFirst`](#chainFirst) + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirstW: (f: (a: A) => Either) => (ma: Either) => Either +``` + +Added in v2.8.0 + +## duplicate + +Derivable from `Extend`. + +**Signature** + +```ts +export declare const duplicate: (ma: Either) => Either> +``` + +Added in v2.0.0 + ## filterOrElse Derivable from `MonadThrow`. @@ -506,6 +494,30 @@ export declare const filterOrElse: { Added in v2.0.0 +## flatten + +The `flatten` function is the conventional monad join operator. It is used to remove one level of monadic structure, projecting its bound argument into the outer level. + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const flatten: (mma: Either>) => Either +``` + +**Example** + +```ts +import * as E from 'fp-ts/Either' + +assert.deepStrictEqual(E.flatten(E.right(E.right('a'))), E.right('a')) +assert.deepStrictEqual(E.flatten(E.right(E.left('e'))), E.left('e')) +assert.deepStrictEqual(E.flatten(E.left('e')), E.left('e')) +``` + +Added in v2.0.0 + ## orElse **Signature** diff --git a/docs/modules/IO.ts.md b/docs/modules/IO.ts.md index be90da3c2..3dcd469f6 100644 --- a/docs/modules/IO.ts.md +++ b/docs/modules/IO.ts.md @@ -26,16 +26,17 @@ Added in v2.0.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [Functor](#functor) - [map](#map) - [Monad](#monad) - [chain](#chain) - - [chainFirst](#chainfirst) - - [flatten](#flatten) - [MonadIO](#monadio) - [fromIO](#fromio) +- [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) + - [chainFirst](#chainfirst) + - [flatten](#flatten) - [instances](#instances) - [Applicative](#applicative-1) - [ChainRec](#chainrec) @@ -84,93 +85,103 @@ export declare const ap: (fa: IO) => (fab: IO<(a: A) => B>) => IO Added in v2.0.0 -## apFirst +# Functor -Combine two effectful actions, keeping only the result of the first. +## map + +`map` can be used to turn functions `(a: A) => B` into functions `(fa: F) => F` whose argument and return types +use the type constructor `F` to represent some computational context. **Signature** ```ts -export declare const apFirst: (fb: IO) => (fa: IO) => IO +export declare const map: (f: (a: A) => B) => (fa: IO) => IO ``` Added in v2.0.0 -## apSecond +# Monad -Combine two effectful actions, keeping only the result of the second. +## chain + +Composes computations in sequence, using the return value of one computation to determine the next computation. **Signature** ```ts -export declare const apSecond: (fb: IO) => (fa: IO) => IO +export declare const chain: (f: (a: A) => IO) => (ma: IO) => IO ``` Added in v2.0.0 -# Functor - -## map +# MonadIO -`map` can be used to turn functions `(a: A) => B` into functions `(fa: F) => F` whose argument and return types -use the type constructor `F` to represent some computational context. +## fromIO **Signature** ```ts -export declare const map: (f: (a: A) => B) => (fa: IO) => IO +export declare const fromIO: (fa: IO) => IO ``` -Added in v2.0.0 +Added in v2.7.0 -# Monad +# combinators -## chain +## apFirst -Composes computations in sequence, using the return value of one computation to determine the next computation. +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. **Signature** ```ts -export declare const chain: (f: (a: A) => IO) => (ma: IO) => IO +export declare const apFirst: (fb: IO) => (fa: IO) => IO ``` Added in v2.0.0 -## chainFirst +## apSecond -Composes computations in sequence, using the return value of one computation to determine the next computation and -keeping only the result of the first. +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. **Signature** ```ts -export declare const chainFirst: (f: (a: A) => IO) => (ma: IO) => IO +export declare const apSecond: (fb: IO) => (fa: IO) => IO ``` Added in v2.0.0 -## flatten +## chainFirst + +Composes computations in sequence, using the return value of one computation to determine the next computation and +keeping only the result of the first. + +Derivable from `Monad`. **Signature** ```ts -export declare const flatten: (mma: IO>) => IO +export declare const chainFirst: (f: (a: A) => IO) => (ma: IO) => IO ``` Added in v2.0.0 -# MonadIO +## flatten -## fromIO +Derivable from `Monad`. **Signature** ```ts -export declare const fromIO: (fa: IO) => IO +export declare const flatten: (mma: IO>) => IO ``` -Added in v2.7.0 +Added in v2.0.0 # instances diff --git a/docs/modules/IOEither.ts.md b/docs/modules/IOEither.ts.md index 3d1a52aa2..98ecd844c 100644 --- a/docs/modules/IOEither.ts.md +++ b/docs/modules/IOEither.ts.md @@ -21,8 +21,6 @@ Added in v2.0.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [apW](#apw) - [Bifunctor](#bifunctor) - [bimap](#bimap) @@ -31,18 +29,20 @@ Added in v2.0.0 - [map](#map) - [Monad](#monad) - [chain](#chain) - - [chainFirst](#chainfirst) - - [chainFirstW](#chainfirstw) - [chainW](#chainw) - - [flatten](#flatten) - [MonadIO](#monadio) - [fromIO](#fromio) - [MonadThrow](#monadthrow) - [throwError](#throwerror) - [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) - [chainEitherK](#chaineitherk) - [chainEitherKW](#chaineitherkw) + - [chainFirst](#chainfirst) + - [chainFirstW](#chainfirstw) - [filterOrElse](#filterorelse) + - [flatten](#flatten) - [fromEitherK](#fromeitherk) - [orElse](#orelse) - [swap](#swap) @@ -136,30 +136,6 @@ export declare const ap: (fa: IOEither) => (fab: IOEither(fb: IOEither) => (fa: IOEither) => IOEither -``` - -Added in v2.0.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: (fb: IOEither) => (fa: IOEither) => IOEither -``` - -Added in v2.0.0 - ## apW Less strict version of [`ap`](#ap). @@ -227,80 +203,71 @@ export declare const chain: (f: (a: A) => IOEither) => (ma: IOEit Added in v2.0.0 -## chainFirst +## chainW -Composes computations in sequence, using the return value of one computation to determine the next computation and -keeping only the result of the first. +Less strict version of [`chain`](#chain). **Signature** ```ts -export declare const chainFirst: (f: (a: A) => IOEither) => (ma: IOEither) => IOEither +export declare const chainW: (f: (a: A) => IOEither) => (ma: IOEither) => IOEither ``` -Added in v2.0.0 +Added in v2.6.0 -## chainFirstW +# MonadIO -Less strict version of [`chainFirst`](#chainFirst). +## fromIO **Signature** ```ts -export declare const chainFirstW: ( - f: (a: A) => IOEither -) => (ma: IOEither) => IOEither +export declare const fromIO: (fa: I.IO) => IOEither ``` -Added in v2.8.0 +Added in v2.7.0 -## chainW +# MonadThrow -Less strict version of [`chain`](#chain). +## throwError **Signature** ```ts -export declare const chainW: (f: (a: A) => IOEither) => (ma: IOEither) => IOEither +export declare const throwError: (e: E) => IOEither ``` -Added in v2.6.0 - -## flatten - -**Signature** +Added in v2.7.0 -```ts -export declare const flatten: (mma: IOEither>) => IOEither -``` +# combinators -Added in v2.0.0 +## apFirst -# MonadIO +Combine two effectful actions, keeping only the result of the first. -## fromIO +Derivable from `Apply`. **Signature** ```ts -export declare const fromIO: (fa: I.IO) => IOEither +export declare const apFirst: (fb: IOEither) => (fa: IOEither) => IOEither ``` -Added in v2.7.0 +Added in v2.0.0 -# MonadThrow +## apSecond -## throwError +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. **Signature** ```ts -export declare const throwError: (e: E) => IOEither +export declare const apSecond: (fb: IOEither) => (fa: IOEither) => IOEither ``` -Added in v2.7.0 - -# combinators +Added in v2.0.0 ## chainEitherK @@ -326,6 +293,37 @@ export declare const chainEitherKW: ( Added in v2.6.1 +## chainFirst + +Composes computations in sequence, using the return value of one computation to determine the next computation and +keeping only the result of the first. + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirst: (f: (a: A) => IOEither) => (ma: IOEither) => IOEither +``` + +Added in v2.0.0 + +## chainFirstW + +Less strict version of [`chainFirst`](#chainFirst). + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirstW: ( + f: (a: A) => IOEither +) => (ma: IOEither) => IOEither +``` + +Added in v2.8.0 + ## filterOrElse Derivable from `MonadThrow`. @@ -341,6 +339,18 @@ export declare const filterOrElse: { Added in v2.0.0 +## flatten + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const flatten: (mma: IOEither>) => IOEither +``` + +Added in v2.0.0 + ## fromEitherK **Signature** @@ -792,6 +802,8 @@ whether the body action throws (\*) or returns. (\*) i.e. returns a `Left` +Derivable from `MonadThrow`. + **Signature** ```ts diff --git a/docs/modules/Identity.ts.md b/docs/modules/Identity.ts.md index 67d010950..9d9ecacb8 100644 --- a/docs/modules/Identity.ts.md +++ b/docs/modules/Identity.ts.md @@ -18,10 +18,7 @@ Added in v2.0.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [Extend](#extend) - - [duplicate](#duplicate) - [extend](#extend) - [Extract](#extract) - [extract](#extract) @@ -33,7 +30,11 @@ Added in v2.0.0 - [map](#map) - [Monad](#monad) - [chain](#chain) +- [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) - [chainFirst](#chainfirst) + - [duplicate](#duplicate) - [flatten](#flatten) - [instances](#instances) - [Alt](#alt-1) @@ -103,42 +104,8 @@ export declare const ap: (fa: A) => (fab: (a: A) => B) => B Added in v2.0.0 -## apFirst - -Combine two effectful actions, keeping only the result of the first. - -**Signature** - -```ts -export declare const apFirst: (fb: B) => (fa: A) => A -``` - -Added in v2.0.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: (fb: B) => (fa: A) => B -``` - -Added in v2.0.0 - # Extend -## duplicate - -**Signature** - -```ts -export declare const duplicate: (ma: A) => A -``` - -Added in v2.0.0 - ## extend **Signature** @@ -222,11 +189,43 @@ export declare const chain: (f: (a: A) => B) => (ma: A) => B Added in v2.0.0 +# combinators + +## apFirst + +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apFirst: (fb: B) => (fa: A) => A +``` + +Added in v2.0.0 + +## apSecond + +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apSecond: (fb: B) => (fa: A) => B +``` + +Added in v2.0.0 + ## chainFirst Composes computations in sequence, using the return value of one computation to determine the next computation and keeping only the result of the first. +Derivable from `Monad`. + **Signature** ```ts @@ -235,8 +234,22 @@ export declare const chainFirst: (f: (a: A) => B) => (ma: A) => A Added in v2.0.0 +## duplicate + +Derivable from `Extend`. + +**Signature** + +```ts +export declare const duplicate: (ma: A) => A +``` + +Added in v2.0.0 + ## flatten +Derivable from `Monad`. + **Signature** ```ts diff --git a/docs/modules/NonEmptyArray.ts.md b/docs/modules/NonEmptyArray.ts.md index 401262b8f..f26453d61 100644 --- a/docs/modules/NonEmptyArray.ts.md +++ b/docs/modules/NonEmptyArray.ts.md @@ -20,10 +20,7 @@ Added in v2.0.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [Extend](#extend) - - [duplicate](#duplicate) - [extend](#extend) - [Foldable](#foldable) - [foldMap](#foldmap) @@ -39,11 +36,14 @@ Added in v2.0.0 - [mapWithIndex](#mapwithindex) - [Monad](#monad) - [chain](#chain) - - [chainFirst](#chainfirst) - - [flatten](#flatten) - [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) + - [chainFirst](#chainfirst) - [copy](#copy) + - [duplicate](#duplicate) - [filter](#filter) + - [flatten](#flatten) - [group](#group) - [groupSort](#groupsort) - [reverse](#reverse) @@ -141,42 +141,8 @@ export declare const ap: (fa: NonEmptyArray) => (fab: NonEmptyArray<(a: Added in v2.0.0 -## apFirst - -Combine two effectful actions, keeping only the result of the first. - -**Signature** - -```ts -export declare const apFirst: (fb: NonEmptyArray) => (fa: NonEmptyArray) => NonEmptyArray -``` - -Added in v2.0.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: (fb: NonEmptyArray) => (fa: NonEmptyArray) => NonEmptyArray -``` - -Added in v2.0.0 - # Extend -## duplicate - -**Signature** - -```ts -export declare const duplicate: (ma: NonEmptyArray) => NonEmptyArray> -``` - -Added in v2.0.0 - ## extend **Signature** @@ -294,11 +260,43 @@ export declare const chain: (f: (a: A) => NonEmptyArray) => (ma: NonEmp Added in v2.0.0 +# combinators + +## apFirst + +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apFirst: (fb: NonEmptyArray) => (fa: NonEmptyArray) => NonEmptyArray +``` + +Added in v2.0.0 + +## apSecond + +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apSecond: (fb: NonEmptyArray) => (fa: NonEmptyArray) => NonEmptyArray +``` + +Added in v2.0.0 + ## chainFirst Composes computations in sequence, using the return value of one computation to determine the next computation and keeping only the result of the first. +Derivable from `Monad`. + **Signature** ```ts @@ -307,24 +305,24 @@ export declare const chainFirst: (f: (a: A) => NonEmptyArray) => (ma: N Added in v2.0.0 -## flatten +## copy **Signature** ```ts -export declare const flatten: (mma: NonEmptyArray>) => NonEmptyArray +export declare function copy(nea: NonEmptyArray): NonEmptyArray ``` Added in v2.0.0 -# combinators +## duplicate -## copy +Derivable from `Extend`. **Signature** ```ts -export declare function copy(nea: NonEmptyArray): NonEmptyArray +export declare const duplicate: (ma: NonEmptyArray) => NonEmptyArray> ``` Added in v2.0.0 @@ -342,6 +340,18 @@ export declare function filter(predicate: Predicate): (nea: NonEmptyArray< Added in v2.0.0 +## flatten + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const flatten: (mma: NonEmptyArray>) => NonEmptyArray +``` + +Added in v2.0.0 + ## group Group equal, consecutive elements of an array into non empty arrays. diff --git a/docs/modules/Option.ts.md b/docs/modules/Option.ts.md index 41c822c7e..158fbba70 100644 --- a/docs/modules/Option.ts.md +++ b/docs/modules/Option.ts.md @@ -31,13 +31,10 @@ Added in v2.0.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [Compactable](#compactable) - [compact](#compact) - [separate](#separate) - [Extend](#extend) - - [duplicate](#duplicate) - [extend](#extend) - [Filterable](#filterable) - [filter](#filter) @@ -52,8 +49,6 @@ Added in v2.0.0 - [map](#map) - [Monad](#monad) - [chain](#chain) - - [chainFirst](#chainfirst) - - [flatten](#flatten) - [MonadThrow](#monadthrow) - [throwError](#throwerror) - [Traversable](#traversable) @@ -63,6 +58,11 @@ Added in v2.0.0 - [wilt](#wilt) - [wither](#wither) - [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) + - [chainFirst](#chainfirst) + - [duplicate](#duplicate) + - [flatten](#flatten) - [mapNullable](#mapnullable) - [constructors](#constructors) - [fromEither](#fromeither) @@ -199,30 +199,6 @@ export declare const ap: (fa: Option) => (fab: Option<(a: A) => B>) => Added in v2.0.0 -## apFirst - -Combine two effectful actions, keeping only the result of the first. - -**Signature** - -```ts -export declare const apFirst: (fb: Option) => (fa: Option) => Option -``` - -Added in v2.0.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: (fb: Option) => (fa: Option) => Option -``` - -Added in v2.0.0 - # Compactable ## compact @@ -247,16 +223,6 @@ Added in v2.0.0 # Extend -## duplicate - -**Signature** - -```ts -export declare const duplicate: (ma: Option) => Option> -``` - -Added in v2.0.0 - ## extend **Signature** @@ -378,29 +344,6 @@ export declare const chain: (f: (a: A) => Option) => (ma: Option) => Added in v2.0.0 -## chainFirst - -Composes computations in sequence, using the return value of one computation to determine the next computation and -keeping only the result of the first. - -**Signature** - -```ts -export declare const chainFirst: (f: (a: A) => Option) => (ma: Option) => Option -``` - -Added in v2.0.0 - -## flatten - -**Signature** - -```ts -export declare const flatten: (mma: Option>) => Option -``` - -Added in v2.0.0 - # MonadThrow ## throwError @@ -459,6 +402,73 @@ Added in v2.6.5 # combinators +## apFirst + +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apFirst: (fb: Option) => (fa: Option) => Option +``` + +Added in v2.0.0 + +## apSecond + +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apSecond: (fb: Option) => (fa: Option) => Option +``` + +Added in v2.0.0 + +## chainFirst + +Composes computations in sequence, using the return value of one computation to determine the next computation and +keeping only the result of the first. + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirst: (f: (a: A) => Option) => (ma: Option) => Option +``` + +Added in v2.0.0 + +## duplicate + +Derivable from `Extend`. + +**Signature** + +```ts +export declare const duplicate: (ma: Option) => Option> +``` + +Added in v2.0.0 + +## flatten + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const flatten: (mma: Option>) => Option +``` + +Added in v2.0.0 + ## mapNullable This is `chain` + `fromNullable`, useful when working with optional values diff --git a/docs/modules/Reader.ts.md b/docs/modules/Reader.ts.md index e286308f6..355381868 100644 --- a/docs/modules/Reader.ts.md +++ b/docs/modules/Reader.ts.md @@ -16,8 +16,6 @@ Added in v2.0.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [apW](#apw) - [Category](#category) - [id](#id) @@ -25,14 +23,16 @@ Added in v2.0.0 - [map](#map) - [Monad](#monad) - [chain](#chain) - - [chainFirst](#chainfirst) - [chainW](#chainw) - - [flatten](#flatten) - [Profunctor](#profunctor) - [promap](#promap) - [Semigroupoid](#semigroupoid) - [compose](#compose) - [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) + - [chainFirst](#chainfirst) + - [flatten](#flatten) - [local](#local) - [constructors](#constructors) - [ask](#ask) @@ -89,30 +89,6 @@ export declare const ap: (fa: Reader) => (fab: Reader(fb: Reader) => (fa: Reader) => Reader -``` - -Added in v2.0.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: (fb: Reader) => (fa: Reader) => Reader -``` - -Added in v2.0.0 - ## apW Less strict version of [`ap`](#ap). @@ -166,66 +142,98 @@ export declare const chain: (f: (a: A) => Reader) => (ma: Reader< Added in v2.0.0 -## chainFirst +## chainW -Composes computations in sequence, using the return value of one computation to determine the next computation and -keeping only the result of the first. +Less strict version of [`chain`](#chain). **Signature** ```ts -export declare const chainFirst: (f: (a: A) => Reader) => (ma: Reader) => Reader +export declare const chainW: (f: (a: A) => Reader) => (ma: Reader) => Reader +``` + +Added in v2.6.0 + +# Profunctor + +## promap + +**Signature** + +```ts +export declare const promap: (f: (d: D) => E, g: (a: A) => B) => (fbc: Reader) => Reader ``` Added in v2.0.0 -## chainW +# Semigroupoid -Less strict version of [`chain`](#chain). +## compose **Signature** ```ts -export declare const chainW: (f: (a: A) => Reader) => (ma: Reader) => Reader +export declare const compose: (ab: Reader) => (bc: Reader) => Reader ``` -Added in v2.6.0 +Added in v2.0.0 -## flatten +# combinators + +## apFirst + +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. **Signature** ```ts -export declare const flatten: (mma: Reader>) => Reader +export declare const apFirst: (fb: Reader) => (fa: Reader) => Reader ``` Added in v2.0.0 -# Profunctor +## apSecond -## promap +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. **Signature** ```ts -export declare const promap: (f: (d: D) => E, g: (a: A) => B) => (fbc: Reader) => Reader +export declare const apSecond: (fb: Reader) => (fa: Reader) => Reader ``` Added in v2.0.0 -# Semigroupoid +## chainFirst -## compose +Composes computations in sequence, using the return value of one computation to determine the next computation and +keeping only the result of the first. + +Derivable from `Monad`. **Signature** ```ts -export declare const compose: (ab: Reader) => (bc: Reader) => Reader +export declare const chainFirst: (f: (a: A) => Reader) => (ma: Reader) => Reader ``` Added in v2.0.0 -# combinators +## flatten + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const flatten: (mma: Reader>) => Reader +``` + +Added in v2.0.0 ## local diff --git a/docs/modules/ReaderEither.ts.md b/docs/modules/ReaderEither.ts.md index fae7b1ec7..de29fc4d6 100644 --- a/docs/modules/ReaderEither.ts.md +++ b/docs/modules/ReaderEither.ts.md @@ -18,8 +18,6 @@ Added in v2.0.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [apW](#apw) - [Bifunctor](#bifunctor) - [bimap](#bimap) @@ -28,16 +26,18 @@ Added in v2.0.0 - [map](#map) - [Monad](#monad) - [chain](#chain) - - [chainFirst](#chainfirst) - - [chainFirstW](#chainfirstw) - [chainW](#chainw) - - [flatten](#flatten) - [MonadThrow](#monadthrow) - [throwError](#throwerror) - [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) - [chainEitherK](#chaineitherk) - [chainEitherKW](#chaineitherkw) + - [chainFirst](#chainfirst) + - [chainFirstW](#chainfirstw) - [filterOrElse](#filterorelse) + - [flatten](#flatten) - [fromEitherK](#fromeitherk) - [local](#local) - [orElse](#orelse) @@ -132,34 +132,6 @@ export declare const ap: ( Added in v2.0.0 -## apFirst - -Combine two effectful actions, keeping only the result of the first. - -**Signature** - -```ts -export declare const apFirst: ( - fb: ReaderEither -) => (fa: ReaderEither) => ReaderEither -``` - -Added in v2.0.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: ( - fb: ReaderEither -) => (fa: ReaderEither) => ReaderEither -``` - -Added in v2.0.0 - ## apW Less strict version of [`ap`](#ap). @@ -234,72 +206,65 @@ export declare const chain: ( Added in v2.0.0 -## chainFirst +## chainW -Composes computations in sequence, using the return value of one computation to determine the next computation and -keeping only the result of the first. +Less strict version of [`chain`](#chain). **Signature** ```ts -export declare const chainFirst: ( +export declare const chainW: ( f: (a: A) => ReaderEither -) => (ma: ReaderEither) => ReaderEither +) => (ma: ReaderEither) => ReaderEither ``` -Added in v2.0.0 +Added in v2.6.0 -## chainFirstW +# MonadThrow -Less strict version of [`chainFirst`](#chainFirst) +## throwError **Signature** ```ts -export declare const chainFirstW: ( - f: (a: A) => ReaderEither -) => (ma: ReaderEither) => ReaderEither +export declare const throwError: (e: E) => ReaderEither ``` -Added in v2.8.0 - -## chainW - -Less strict version of [`chain`](#chain). +Added in v2.7.0 -**Signature** +# combinators -```ts -export declare const chainW: ( - f: (a: A) => ReaderEither -) => (ma: ReaderEither) => ReaderEither -``` +## apFirst -Added in v2.6.0 +Combine two effectful actions, keeping only the result of the first. -## flatten +Derivable from `Apply`. **Signature** ```ts -export declare const flatten: (mma: ReaderEither>) => ReaderEither +export declare const apFirst: ( + fb: ReaderEither +) => (fa: ReaderEither) => ReaderEither ``` Added in v2.0.0 -# MonadThrow +## apSecond -## throwError +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. **Signature** ```ts -export declare const throwError: (e: E) => ReaderEither +export declare const apSecond: ( + fb: ReaderEither +) => (fa: ReaderEither) => ReaderEither ``` -Added in v2.7.0 - -# combinators +Added in v2.0.0 ## chainEitherK @@ -327,6 +292,39 @@ export declare const chainEitherKW: ( Added in v2.6.1 +## chainFirst + +Composes computations in sequence, using the return value of one computation to determine the next computation and +keeping only the result of the first. + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirst: ( + f: (a: A) => ReaderEither +) => (ma: ReaderEither) => ReaderEither +``` + +Added in v2.0.0 + +## chainFirstW + +Less strict version of [`chainFirst`](#chainFirst) + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirstW: ( + f: (a: A) => ReaderEither +) => (ma: ReaderEither) => ReaderEither +``` + +Added in v2.8.0 + ## filterOrElse Derivable from `MonadThrow`. @@ -344,6 +342,18 @@ export declare const filterOrElse: { Added in v2.0.0 +## flatten + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const flatten: (mma: ReaderEither>) => ReaderEither +``` + +Added in v2.0.0 + ## fromEitherK **Signature** diff --git a/docs/modules/ReaderTask.ts.md b/docs/modules/ReaderTask.ts.md index 3347609cd..6a146dee3 100644 --- a/docs/modules/ReaderTask.ts.md +++ b/docs/modules/ReaderTask.ts.md @@ -16,19 +16,19 @@ Added in v2.3.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [apW](#apw) - [Functor](#functor) - [map](#map) - [Monad](#monad) - [chain](#chain) - - [chainFirst](#chainfirst) - [chainW](#chainw) - - [flatten](#flatten) - [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) + - [chainFirst](#chainfirst) - [chainIOK](#chainiok) - [chainTaskK](#chaintaskk) + - [flatten](#flatten) - [fromIOK](#fromiok) - [fromTaskK](#fromtaskk) - [local](#local) @@ -88,30 +88,6 @@ export declare const ap: (fa: ReaderTask) => (fab: ReaderTask(fb: ReaderTask) => (fa: ReaderTask) => ReaderTask -``` - -Added in v2.3.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: (fb: ReaderTask) => (fa: ReaderTask) => ReaderTask -``` - -Added in v2.3.0 - ## apW Less strict version of [`ap`](#ap). @@ -155,44 +131,64 @@ export declare const chain: (f: (a: A) => ReaderTask) => (ma: Rea Added in v2.3.0 -## chainFirst +## chainW -Composes computations in sequence, using the return value of one computation to determine the next computation and -keeping only the result of the first. +Less strict version of [`chain`](#chain). **Signature** ```ts -export declare const chainFirst: (f: (a: A) => ReaderTask) => (ma: ReaderTask) => ReaderTask +export declare const chainW: ( + f: (a: A) => ReaderTask +) => (ma: ReaderTask) => ReaderTask ``` -Added in v2.3.0 +Added in v2.6.7 -## chainW +# combinators -Less strict version of [`chain`](#chain). +## apFirst + +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. **Signature** ```ts -export declare const chainW: ( - f: (a: A) => ReaderTask -) => (ma: ReaderTask) => ReaderTask +export declare const apFirst: (fb: ReaderTask) => (fa: ReaderTask) => ReaderTask ``` -Added in v2.6.7 +Added in v2.3.0 -## flatten +## apSecond + +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. **Signature** ```ts -export declare const flatten: (mma: ReaderTask>) => ReaderTask +export declare const apSecond: (fb: ReaderTask) => (fa: ReaderTask) => ReaderTask ``` Added in v2.3.0 -# combinators +## chainFirst + +Composes computations in sequence, using the return value of one computation to determine the next computation and +keeping only the result of the first. + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirst: (f: (a: A) => ReaderTask) => (ma: ReaderTask) => ReaderTask +``` + +Added in v2.3.0 ## chainIOK @@ -214,6 +210,18 @@ export declare const chainTaskK: (f: (a: A) => T.Task) => (ma: Reade Added in v2.4.0 +## flatten + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const flatten: (mma: ReaderTask>) => ReaderTask +``` + +Added in v2.3.0 + ## fromIOK **Signature** diff --git a/docs/modules/ReaderTaskEither.ts.md b/docs/modules/ReaderTaskEither.ts.md index 1bb34f008..a64a9c125 100644 --- a/docs/modules/ReaderTaskEither.ts.md +++ b/docs/modules/ReaderTaskEither.ts.md @@ -18,8 +18,6 @@ Added in v2.0.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [apW](#apw) - [Bifunctor](#bifunctor) - [bimap](#bimap) @@ -28,10 +26,7 @@ Added in v2.0.0 - [map](#map) - [Monad](#monad) - [chain](#chain) - - [chainFirst](#chainfirst) - - [chainFirstW](#chainfirstw) - [chainW](#chainw) - - [flatten](#flatten) - [MonadIO](#monadio) - [fromIO](#fromio) - [MonadTask](#monadtask) @@ -39,13 +34,18 @@ Added in v2.0.0 - [MonadThrow](#monadthrow) - [throwError](#throwerror) - [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) - [chainEitherK](#chaineitherk) - [chainEitherKW](#chaineitherkw) + - [chainFirst](#chainfirst) + - [chainFirstW](#chainfirstw) - [chainIOEitherK](#chainioeitherk) - [chainIOEitherKW](#chainioeitherkw) - [chainTaskEitherK](#chaintaskeitherk) - [chainTaskEitherKW](#chaintaskeitherkw) - [filterOrElse](#filterorelse) + - [flatten](#flatten) - [fromEitherK](#fromeitherk) - [fromIOEitherK](#fromioeitherk) - [fromTaskEitherK](#fromtaskeitherk) @@ -153,34 +153,6 @@ export declare const ap: ( Added in v2.0.0 -## apFirst - -Combine two effectful actions, keeping only the result of the first. - -**Signature** - -```ts -export declare const apFirst: ( - fb: ReaderTaskEither -) => (fa: ReaderTaskEither) => ReaderTaskEither -``` - -Added in v2.0.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: ( - fb: ReaderTaskEither -) => (fa: ReaderTaskEither) => ReaderTaskEither -``` - -Added in v2.0.0 - ## apW Less strict version of [`ap`](#ap). @@ -257,99 +229,90 @@ export declare const chain: ( Added in v2.0.0 -## chainFirst +## chainW -Composes computations in sequence, using the return value of one computation to determine the next computation and -keeping only the result of the first. +Less strict version of [`chain`](#chain). **Signature** ```ts -export declare const chainFirst: ( +export declare const chainW: ( f: (a: A) => ReaderTaskEither -) => (ma: ReaderTaskEither) => ReaderTaskEither +) => (ma: ReaderTaskEither) => ReaderTaskEither ``` -Added in v2.0.0 +Added in v2.6.0 -## chainFirstW +# MonadIO -Less strict version of [`chainFirst`](#chainFirst). +## fromIO **Signature** ```ts -export declare const chainFirstW: ( - f: (a: A) => ReaderTaskEither -) => (ma: ReaderTaskEither) => ReaderTaskEither +export declare const fromIO: (fa: IO) => ReaderTaskEither ``` -Added in v2.8.0 - -## chainW - -Less strict version of [`chain`](#chain). - -**Signature** - -```ts -export declare const chainW: ( - f: (a: A) => ReaderTaskEither -) => (ma: ReaderTaskEither) => ReaderTaskEither -``` +Added in v2.0.0 -Added in v2.6.0 +# MonadTask -## flatten +## fromTask **Signature** ```ts -export declare const flatten: ( - mma: ReaderTaskEither> -) => ReaderTaskEither +export declare const fromTask: (fa: T.Task) => ReaderTaskEither ``` Added in v2.0.0 -# MonadIO +# MonadThrow -## fromIO +## throwError **Signature** ```ts -export declare const fromIO: (fa: IO) => ReaderTaskEither +export declare const throwError: (e: E) => ReaderTaskEither ``` Added in v2.0.0 -# MonadTask +# combinators -## fromTask +## apFirst + +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. **Signature** ```ts -export declare const fromTask: (fa: T.Task) => ReaderTaskEither +export declare const apFirst: ( + fb: ReaderTaskEither +) => (fa: ReaderTaskEither) => ReaderTaskEither ``` Added in v2.0.0 -# MonadThrow +## apSecond -## throwError +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. **Signature** ```ts -export declare const throwError: (e: E) => ReaderTaskEither +export declare const apSecond: ( + fb: ReaderTaskEither +) => (fa: ReaderTaskEither) => ReaderTaskEither ``` Added in v2.0.0 -# combinators - ## chainEitherK **Signature** @@ -376,6 +339,39 @@ export declare const chainEitherKW: ( Added in v2.6.1 +## chainFirst + +Composes computations in sequence, using the return value of one computation to determine the next computation and +keeping only the result of the first. + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirst: ( + f: (a: A) => ReaderTaskEither +) => (ma: ReaderTaskEither) => ReaderTaskEither +``` + +Added in v2.0.0 + +## chainFirstW + +Less strict version of [`chainFirst`](#chainFirst). + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirstW: ( + f: (a: A) => ReaderTaskEither +) => (ma: ReaderTaskEither) => ReaderTaskEither +``` + +Added in v2.8.0 + ## chainIOEitherK **Signature** @@ -445,6 +441,20 @@ export declare const filterOrElse: { Added in v2.0.0 +## flatten + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const flatten: ( + mma: ReaderTaskEither> +) => ReaderTaskEither +``` + +Added in v2.0.0 + ## fromEitherK **Signature** @@ -1006,6 +1016,8 @@ whether the body action throws (\*) or returns. (\*) i.e. returns a `Left` +Derivable from `MonadThrow`. + **Signature** ```ts diff --git a/docs/modules/ReadonlyArray.ts.md b/docs/modules/ReadonlyArray.ts.md index eb2800dcc..0afc64386 100644 --- a/docs/modules/ReadonlyArray.ts.md +++ b/docs/modules/ReadonlyArray.ts.md @@ -20,13 +20,10 @@ Added in v2.5.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [Compactable](#compactable) - [compact](#compact) - [separate](#separate) - [Extend](#extend) - - [duplicate](#duplicate) - [extend](#extend) - [Filterable](#filterable) - [filter](#filter) @@ -52,8 +49,6 @@ Added in v2.5.0 - [mapWithIndex](#mapwithindex) - [Monad](#monad) - [chain](#chain) - - [chainFirst](#chainfirst) - - [flatten](#flatten) - [Traversable](#traversable) - [sequence](#sequence) - [traverse](#traverse) @@ -65,11 +60,16 @@ Added in v2.5.0 - [wilt](#wilt) - [wither](#wither) - [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) + - [chainFirst](#chainfirst) - [chop](#chop) - [difference](#difference) - [dropLeft](#dropleft) - [dropLeftWhile](#dropleftwhile) - [dropRight](#dropright) + - [duplicate](#duplicate) + - [flatten](#flatten) - [intersection](#intersection) - [reverse](#reverse) - [rights](#rights) @@ -215,30 +215,6 @@ export declare const ap: (fa: readonly A[]) => (fab: readonly ((a: A) => B Added in v2.5.0 -## apFirst - -Combine two effectful actions, keeping only the result of the first. - -**Signature** - -```ts -export declare const apFirst: (fb: readonly B[]) => (fa: readonly A[]) => readonly A[] -``` - -Added in v2.5.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: (fb: readonly B[]) => (fa: readonly A[]) => readonly B[] -``` - -Added in v2.5.0 - # Compactable ## compact @@ -263,16 +239,6 @@ Added in v2.5.0 # Extend -## duplicate - -**Signature** - -```ts -export declare const duplicate: (wa: readonly A[]) => readonly (readonly A[])[] -``` - -Added in v2.5.0 - ## extend **Signature** @@ -490,39 +456,6 @@ export declare const chain: (f: (a: A) => readonly B[]) => (ma: readonly A Added in v2.5.0 -## chainFirst - -Composes computations in sequence, using the return value of one computation to determine the next computation and -keeping only the result of the first. - -**Signature** - -```ts -export declare const chainFirst: (f: (a: A) => readonly B[]) => (ma: readonly A[]) => readonly A[] -``` - -Added in v2.5.0 - -## flatten - -Removes one level of nesting - -**Signature** - -```ts -export declare function flatten(mma: ReadonlyArray>): ReadonlyArray -``` - -**Example** - -```ts -import { flatten } from 'fp-ts/ReadonlyArray' - -assert.deepStrictEqual(flatten([[1], [2], [3]]), [1, 2, 3]) -``` - -Added in v2.5.0 - # Traversable ## sequence @@ -593,6 +526,49 @@ Added in v2.6.5 # combinators +## apFirst + +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apFirst: (fb: readonly B[]) => (fa: readonly A[]) => readonly A[] +``` + +Added in v2.5.0 + +## apSecond + +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apSecond: (fb: readonly B[]) => (fa: readonly A[]) => readonly B[] +``` + +Added in v2.5.0 + +## chainFirst + +Composes computations in sequence, using the return value of one computation to determine the next computation and +keeping only the result of the first. + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirst: (f: (a: A) => readonly B[]) => (ma: readonly A[]) => readonly A[] +``` + +Added in v2.5.0 + ## chop A useful recursion pattern for processing an array to produce a new array, often used for "chopping" up the input @@ -712,6 +688,40 @@ assert.deepStrictEqual(dropRight(2)([1, 2, 3, 4, 5]), [1, 2, 3]) Added in v2.5.0 +## duplicate + +Derivable from `Extend`. + +**Signature** + +```ts +export declare const duplicate: (wa: readonly A[]) => readonly (readonly A[])[] +``` + +Added in v2.5.0 + +## flatten + +Removes one level of nesting + +Derivable from `Monad`. + +**Signature** + +```ts +export declare function flatten(mma: ReadonlyArray>): ReadonlyArray +``` + +**Example** + +```ts +import { flatten } from 'fp-ts/ReadonlyArray' + +assert.deepStrictEqual(flatten([[1], [2], [3]]), [1, 2, 3]) +``` + +Added in v2.5.0 + ## intersection Creates an array of unique values that are included in all given arrays using a `Eq` for equality diff --git a/docs/modules/ReadonlyNonEmptyArray.ts.md b/docs/modules/ReadonlyNonEmptyArray.ts.md index cf9b03ed2..2b423c89c 100644 --- a/docs/modules/ReadonlyNonEmptyArray.ts.md +++ b/docs/modules/ReadonlyNonEmptyArray.ts.md @@ -20,10 +20,7 @@ Added in v2.5.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [Extend](#extend) - - [duplicate](#duplicate) - [extend](#extend) - [Foldable](#foldable) - [foldMap](#foldmap) @@ -39,9 +36,12 @@ Added in v2.5.0 - [mapWithIndex](#mapwithindex) - [Monad](#monad) - [chain](#chain) +- [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) - [chainFirst](#chainfirst) + - [duplicate](#duplicate) - [flatten](#flatten) -- [combinators](#combinators) - [group](#group) - [groupSort](#groupsort) - [reverse](#reverse) @@ -143,46 +143,8 @@ export declare const ap: ( Added in v2.5.0 -## apFirst - -Combine two effectful actions, keeping only the result of the first. - -**Signature** - -```ts -export declare const apFirst: ( - fb: ReadonlyNonEmptyArray -) => (fa: ReadonlyNonEmptyArray) => ReadonlyNonEmptyArray -``` - -Added in v2.5.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: ( - fb: ReadonlyNonEmptyArray -) => (fa: ReadonlyNonEmptyArray) => ReadonlyNonEmptyArray -``` - -Added in v2.5.0 - # Extend -## duplicate - -**Signature** - -```ts -export declare const duplicate: (ma: ReadonlyNonEmptyArray) => ReadonlyNonEmptyArray> -``` - -Added in v2.5.0 - ## extend **Signature** @@ -312,11 +274,47 @@ export declare const chain: ( Added in v2.5.0 +# combinators + +## apFirst + +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apFirst: ( + fb: ReadonlyNonEmptyArray +) => (fa: ReadonlyNonEmptyArray) => ReadonlyNonEmptyArray +``` + +Added in v2.5.0 + +## apSecond + +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apSecond: ( + fb: ReadonlyNonEmptyArray +) => (fa: ReadonlyNonEmptyArray) => ReadonlyNonEmptyArray +``` + +Added in v2.5.0 + ## chainFirst Composes computations in sequence, using the return value of one computation to determine the next computation and keeping only the result of the first. +Derivable from `Monad`. + **Signature** ```ts @@ -327,8 +325,22 @@ export declare const chainFirst: ( Added in v2.5.0 +## duplicate + +Derivable from `Extend`. + +**Signature** + +```ts +export declare const duplicate: (ma: ReadonlyNonEmptyArray) => ReadonlyNonEmptyArray> +``` + +Added in v2.5.0 + ## flatten +Derivable from `Monad`. + **Signature** ```ts @@ -337,8 +349,6 @@ export declare const flatten: (mma: ReadonlyNonEmptyArray(wa: readonly [A, E]) => readonly [readonly [A, E], E] -``` - -Added in v2.5.0 - ## extend **Signature** @@ -175,6 +165,18 @@ Added in v2.5.0 # combinators +## duplicate + +Derivable from `Extend`. + +**Signature** + +```ts +export declare const duplicate: (wa: readonly [A, E]) => readonly [readonly [A, E], E] +``` + +Added in v2.5.0 + ## swap **Signature** diff --git a/docs/modules/State.ts.md b/docs/modules/State.ts.md index 284161157..bb94c0533 100644 --- a/docs/modules/State.ts.md +++ b/docs/modules/State.ts.md @@ -16,12 +16,13 @@ Added in v2.0.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [Functor](#functor) - [map](#map) - [Monad](#monad) - [chain](#chain) +- [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) - [chainFirst](#chainfirst) - [flatten](#flatten) - [constructors](#constructors) @@ -77,55 +78,61 @@ export declare const ap: (fa: State) => (fab: State Added in v2.0.0 -## apFirst +# Functor -Combine two effectful actions, keeping only the result of the first. +## map + +`map` can be used to turn functions `(a: A) => B` into functions `(fa: F) => F` whose argument and return types +use the type constructor `F` to represent some computational context. **Signature** ```ts -export declare const apFirst: (fb: State) => (fa: State) => State +export declare const map: (f: (a: A) => B) => (fa: State) => State ``` Added in v2.0.0 -## apSecond +# Monad -Combine two effectful actions, keeping only the result of the second. +## chain + +Composes computations in sequence, using the return value of one computation to determine the next computation. **Signature** ```ts -export declare const apSecond: (fb: State) => (fa: State) => State +export declare const chain: (f: (a: A) => State) => (ma: State) => State ``` Added in v2.0.0 -# Functor +# combinators -## map +## apFirst -`map` can be used to turn functions `(a: A) => B` into functions `(fa: F) => F` whose argument and return types -use the type constructor `F` to represent some computational context. +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. **Signature** ```ts -export declare const map: (f: (a: A) => B) => (fa: State) => State +export declare const apFirst: (fb: State) => (fa: State) => State ``` Added in v2.0.0 -# Monad +## apSecond -## chain +Combine two effectful actions, keeping only the result of the second. -Composes computations in sequence, using the return value of one computation to determine the next computation. +Derivable from `Apply`. **Signature** ```ts -export declare const chain: (f: (a: A) => State) => (ma: State) => State +export declare const apSecond: (fb: State) => (fa: State) => State ``` Added in v2.0.0 @@ -135,6 +142,8 @@ Added in v2.0.0 Composes computations in sequence, using the return value of one computation to determine the next computation and keeping only the result of the first. +Derivable from `Monad`. + **Signature** ```ts @@ -145,6 +154,8 @@ Added in v2.0.0 ## flatten +Derivable from `Monad`. + **Signature** ```ts diff --git a/docs/modules/StateReaderTaskEither.ts.md b/docs/modules/StateReaderTaskEither.ts.md index 85ae6b851..9dee5a22f 100644 --- a/docs/modules/StateReaderTaskEither.ts.md +++ b/docs/modules/StateReaderTaskEither.ts.md @@ -18,8 +18,6 @@ Added in v2.0.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [apW](#apw) - [Bifunctor](#bifunctor) - [bimap](#bimap) @@ -28,10 +26,7 @@ Added in v2.0.0 - [map](#map) - [Monad](#monad) - [chain](#chain) - - [chainFirst](#chainfirst) - - [chainFirstW](#chainfirstw) - [chainW](#chainw) - - [flatten](#flatten) - [MonadIO](#monadio) - [fromIO](#fromio) - [MonadTask](#monadtask) @@ -39,8 +34,12 @@ Added in v2.0.0 - [MonadThrow](#monadthrow) - [throwError](#throwerror) - [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) - [chainEitherK](#chaineitherk) - [chainEitherKW](#chaineitherkw) + - [chainFirst](#chainfirst) + - [chainFirstW](#chainfirstw) - [chainIOEitherK](#chainioeitherk) - [chainIOEitherKW](#chainioeitherkw) - [chainReaderTaskEitherK](#chainreadertaskeitherk) @@ -48,6 +47,7 @@ Added in v2.0.0 - [chainTaskEitherK](#chaintaskeitherk) - [chainTaskEitherKW](#chaintaskeitherkw) - [filterOrElse](#filterorelse) + - [flatten](#flatten) - [fromEitherK](#fromeitherk) - [fromIOEitherK](#fromioeitherk) - [fromReaderTaskEitherK](#fromreadertaskeitherk) @@ -146,34 +146,6 @@ export declare const ap: ( Added in v2.0.0 -## apFirst - -Combine two effectful actions, keeping only the result of the first. - -**Signature** - -```ts -export declare const apFirst: ( - fb: StateReaderTaskEither -) => (fa: StateReaderTaskEither) => StateReaderTaskEither -``` - -Added in v2.0.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: ( - fb: StateReaderTaskEither -) => (fa: StateReaderTaskEither) => StateReaderTaskEither -``` - -Added in v2.0.0 - ## apW Less strict version of [`ap`](#ap). @@ -252,35 +224,6 @@ export declare const chain: ( Added in v2.0.0 -## chainFirst - -Composes computations in sequence, using the return value of one computation to determine the next computation and -keeping only the result of the first. - -**Signature** - -```ts -export declare const chainFirst: ( - f: (a: A) => StateReaderTaskEither -) => (ma: StateReaderTaskEither) => StateReaderTaskEither -``` - -Added in v2.0.0 - -## chainFirstW - -Less strict version of [`chainFirst`](#chainFirst). - -**Signature** - -```ts -export declare const chainFirstW: ( - f: (a: A) => StateReaderTaskEither -) => (ma: StateReaderTaskEither) => StateReaderTaskEither -``` - -Added in v2.8.0 - ## chainW Less strict version of [`chain`](#chain). @@ -295,18 +238,6 @@ export declare const chainW: ( Added in v2.6.0 -## flatten - -**Signature** - -```ts -export declare const flatten: ( - mma: StateReaderTaskEither> -) => StateReaderTaskEither -``` - -Added in v2.0.0 - # MonadIO ## fromIO @@ -345,6 +276,38 @@ Added in v2.7.0 # combinators +## apFirst + +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apFirst: ( + fb: StateReaderTaskEither +) => (fa: StateReaderTaskEither) => StateReaderTaskEither +``` + +Added in v2.0.0 + +## apSecond + +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apSecond: ( + fb: StateReaderTaskEither +) => (fa: StateReaderTaskEither) => StateReaderTaskEither +``` + +Added in v2.0.0 + ## chainEitherK **Signature** @@ -371,6 +334,39 @@ export declare const chainEitherKW: ( Added in v2.6.1 +## chainFirst + +Composes computations in sequence, using the return value of one computation to determine the next computation and +keeping only the result of the first. + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirst: ( + f: (a: A) => StateReaderTaskEither +) => (ma: StateReaderTaskEither) => StateReaderTaskEither +``` + +Added in v2.0.0 + +## chainFirstW + +Less strict version of [`chainFirst`](#chainFirst). + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirstW: ( + f: (a: A) => StateReaderTaskEither +) => (ma: StateReaderTaskEither) => StateReaderTaskEither +``` + +Added in v2.8.0 + ## chainIOEitherK **Signature** @@ -468,6 +464,20 @@ export declare const filterOrElse: { Added in v2.4.4 +## flatten + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const flatten: ( + mma: StateReaderTaskEither> +) => StateReaderTaskEither +``` + +Added in v2.0.0 + ## fromEitherK **Signature** diff --git a/docs/modules/Store.ts.md b/docs/modules/Store.ts.md index 37d79449b..65de0640a 100644 --- a/docs/modules/Store.ts.md +++ b/docs/modules/Store.ts.md @@ -13,12 +13,13 @@ Added in v2.0.0

Table of contents

- [Extend](#extend) - - [duplicate](#duplicate) - [extend](#extend) - [Extract](#extract) - [extract](#extract) - [Functor](#functor) - [map](#map) +- [combinators](#combinators) + - [duplicate](#duplicate) - [instances](#instances) - [Comonad](#comonad) - [Functor](#functor-1) @@ -37,16 +38,6 @@ Added in v2.0.0 # Extend -## duplicate - -**Signature** - -```ts -export declare const duplicate: (wa: Store) => Store> -``` - -Added in v2.0.0 - ## extend **Signature** @@ -84,6 +75,20 @@ export declare const map: (f: (a: A) => B) => (fa: Store) => Stor Added in v2.0.0 +# combinators + +## duplicate + +Derivable from `Extend`. + +**Signature** + +```ts +export declare const duplicate: (wa: Store) => Store> +``` + +Added in v2.0.0 + # instances ## Comonad diff --git a/docs/modules/Task.ts.md b/docs/modules/Task.ts.md index 4d31a8d87..5bd78d576 100644 --- a/docs/modules/Task.ts.md +++ b/docs/modules/Task.ts.md @@ -25,19 +25,19 @@ Added in v2.0.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [Functor](#functor) - [map](#map) - [Monad](#monad) - [chain](#chain) - - [chainFirst](#chainfirst) - - [flatten](#flatten) - [MonadTask](#monadtask) - [fromTask](#fromtask) - [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) + - [chainFirst](#chainfirst) - [chainIOK](#chainiok) - [delay](#delay) + - [flatten](#flatten) - [fromIOK](#fromiok) - [constructors](#constructors) - [fromIO](#fromio) @@ -90,30 +90,6 @@ export declare const ap:
(fa: Task) => (fab: Task<(a: A) => B>) => Task Added in v2.0.0 -## apFirst - -Combine two effectful actions, keeping only the result of the first. - -**Signature** - -```ts -export declare const apFirst: (fb: Task) => (fa: Task) => Task -``` - -Added in v2.0.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: (fb: Task) => (fa: Task) => Task -``` - -Added in v2.0.0 - # Functor ## map @@ -143,42 +119,62 @@ export declare const chain: (f: (a: A) => Task) => (ma: Task) => Tas Added in v2.0.0 -## chainFirst +# MonadTask -Composes computations in sequence, using the return value of one computation to determine the next computation and -keeping only the result of the first. +## fromTask **Signature** ```ts -export declare const chainFirst: (f: (a: A) => Task) => (ma: Task) => Task +export declare const fromTask: (fa: Task) => Task ``` -Added in v2.0.0 +Added in v2.7.0 -## flatten +# combinators + +## apFirst + +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. **Signature** ```ts -export declare const flatten: (mma: Task>) => Task +export declare const apFirst: (fb: Task) => (fa: Task) => Task ``` Added in v2.0.0 -# MonadTask +## apSecond -## fromTask +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. **Signature** ```ts -export declare const fromTask: (fa: Task) => Task +export declare const apSecond: (fb: Task) => (fa: Task) => Task ``` -Added in v2.7.0 +Added in v2.0.0 -# combinators +## chainFirst + +Composes computations in sequence, using the return value of one computation to determine the next computation and +keeping only the result of the first. + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirst: (f: (a: A) => Task) => (ma: Task) => Task +``` + +Added in v2.0.0 ## chainIOK @@ -225,6 +221,18 @@ test() Added in v2.0.0 +## flatten + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const flatten: (mma: Task>) => Task +``` + +Added in v2.0.0 + ## fromIOK **Signature** diff --git a/docs/modules/TaskEither.ts.md b/docs/modules/TaskEither.ts.md index e74248896..de9d46430 100644 --- a/docs/modules/TaskEither.ts.md +++ b/docs/modules/TaskEither.ts.md @@ -25,8 +25,6 @@ Added in v2.0.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [apW](#apw) - [Bifunctor](#bifunctor) - [bimap](#bimap) @@ -35,21 +33,23 @@ Added in v2.0.0 - [map](#map) - [Monad](#monad) - [chain](#chain) - - [chainFirst](#chainfirst) - - [chainFirstW](#chainfirstw) - [chainW](#chainw) - - [flatten](#flatten) - [MonadIO](#monadio) - [fromIO](#fromio) - [MonadTask](#monadtask) - [fromTask](#fromtask) - [throwError](#throwerror) - [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) - [chainEitherK](#chaineitherk) - [chainEitherKW](#chaineitherkw) + - [chainFirst](#chainfirst) + - [chainFirstW](#chainfirstw) - [chainIOEitherK](#chainioeitherk) - [chainIOEitherKW](#chainioeitherkw) - [filterOrElse](#filterorelse) + - [flatten](#flatten) - [fromEitherK](#fromeitherk) - [fromIOEitherK](#fromioeitherk) - [orElse](#orelse) @@ -184,30 +184,6 @@ export declare const ap: (fa: TaskEither) => (fab: TaskEither(fb: TaskEither) => (fa: TaskEither) => TaskEither -``` - -Added in v2.0.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: (fb: TaskEither) => (fa: TaskEither) => TaskEither -``` - -Added in v2.0.0 - ## apW Less strict version of [`ap`](#ap). @@ -277,33 +253,6 @@ export declare const chain: (f: (a: A) => TaskEither) => (ma: Tas Added in v2.0.0 -## chainFirst - -Composes computations in sequence, using the return value of one computation to determine the next computation and -keeping only the result of the first. - -**Signature** - -```ts -export declare const chainFirst: (f: (a: A) => TaskEither) => (ma: TaskEither) => TaskEither -``` - -Added in v2.0.0 - -## chainFirstW - -Less strict version of [`chainFirst`](#chainFirst). - -**Signature** - -```ts -export declare const chainFirstW: ( - f: (a: A) => TaskEither -) => (ma: TaskEither) => TaskEither -``` - -Added in v2.8.0 - ## chainW Less strict version of [`chain`](#chain). @@ -318,16 +267,6 @@ export declare const chainW: ( Added in v2.6.0 -## flatten - -**Signature** - -```ts -export declare const flatten: (mma: TaskEither>) => TaskEither -``` - -Added in v2.0.0 - # MonadIO ## fromIO @@ -364,6 +303,34 @@ Added in v2.7.0 # combinators +## apFirst + +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apFirst: (fb: TaskEither) => (fa: TaskEither) => TaskEither +``` + +Added in v2.0.0 + +## apSecond + +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apSecond: (fb: TaskEither) => (fa: TaskEither) => TaskEither +``` + +Added in v2.0.0 + ## chainEitherK **Signature** @@ -388,6 +355,37 @@ export declare const chainEitherKW: ( Added in v2.6.1 +## chainFirst + +Composes computations in sequence, using the return value of one computation to determine the next computation and +keeping only the result of the first. + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirst: (f: (a: A) => TaskEither) => (ma: TaskEither) => TaskEither +``` + +Added in v2.0.0 + +## chainFirstW + +Less strict version of [`chainFirst`](#chainFirst). + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const chainFirstW: ( + f: (a: A) => TaskEither +) => (ma: TaskEither) => TaskEither +``` + +Added in v2.8.0 + ## chainIOEitherK **Signature** @@ -429,6 +427,18 @@ export declare const filterOrElse: { Added in v2.0.0 +## flatten + +Derivable from `Monad`. + +**Signature** + +```ts +export declare const flatten: (mma: TaskEither>) => TaskEither +``` + +Added in v2.0.0 + ## fromEitherK **Signature** @@ -949,6 +959,8 @@ whether the body action throws (\*) or returns. (\*) i.e. returns a `Left` +Derivable from `MonadThrow`. + **Signature** ```ts diff --git a/docs/modules/Tree.ts.md b/docs/modules/Tree.ts.md index 2fdcff427..66e2e7435 100644 --- a/docs/modules/Tree.ts.md +++ b/docs/modules/Tree.ts.md @@ -22,10 +22,7 @@ Added in v2.0.0 - [of](#of) - [Apply](#apply) - [ap](#ap) - - [apFirst](#apfirst) - - [apSecond](#apsecond) - [Extend](#extend) - - [duplicate](#duplicate) - [extend](#extend) - [Extract](#extract) - [extract](#extract) @@ -37,7 +34,11 @@ Added in v2.0.0 - [map](#map) - [Monad](#monad) - [chain](#chain) +- [combinators](#combinators) + - [apFirst](#apfirst) + - [apSecond](#apsecond) - [chainFirst](#chainfirst) + - [duplicate](#duplicate) - [flatten](#flatten) - [constructors](#constructors) - [make](#make) @@ -102,42 +103,8 @@ export declare const ap: (fa: Tree) => (fab: Tree<(a: A) => B>) => Tree Added in v2.0.0 -## apFirst - -Combine two effectful actions, keeping only the result of the first. - -**Signature** - -```ts -export declare const apFirst: (fb: Tree) => (fa: Tree) => Tree -``` - -Added in v2.0.0 - -## apSecond - -Combine two effectful actions, keeping only the result of the second. - -**Signature** - -```ts -export declare const apSecond: (fb: Tree) => (fa: Tree) => Tree -``` - -Added in v2.0.0 - # Extend -## duplicate - -**Signature** - -```ts -export declare const duplicate: (wa: Tree) => Tree> -``` - -Added in v2.0.0 - ## extend **Signature** @@ -221,11 +188,43 @@ export declare const chain: (f: (a: A) => Tree) => (ma: Tree) => Tre Added in v2.0.0 +# combinators + +## apFirst + +Combine two effectful actions, keeping only the result of the first. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apFirst: (fb: Tree) => (fa: Tree) => Tree +``` + +Added in v2.0.0 + +## apSecond + +Combine two effectful actions, keeping only the result of the second. + +Derivable from `Apply`. + +**Signature** + +```ts +export declare const apSecond: (fb: Tree) => (fa: Tree) => Tree +``` + +Added in v2.0.0 + ## chainFirst Composes computations in sequence, using the return value of one computation to determine the next computation and keeping only the result of the first. +Derivable from `Monad`. + **Signature** ```ts @@ -234,8 +233,22 @@ export declare const chainFirst: (f: (a: A) => Tree) => (ma: Tree) = Added in v2.0.0 +## duplicate + +Derivable from `Extend`. + +**Signature** + +```ts +export declare const duplicate: (wa: Tree) => Tree> +``` + +Added in v2.0.0 + ## flatten +Derivable from `Monad`. + **Signature** ```ts diff --git a/docs/modules/Tuple.ts.md b/docs/modules/Tuple.ts.md index 20e31deac..c0f76af73 100644 --- a/docs/modules/Tuple.ts.md +++ b/docs/modules/Tuple.ts.md @@ -16,7 +16,6 @@ Added in v2.0.0 - [bimap](#bimap) - [mapLeft](#mapleft) - [Extend](#extend) - - [duplicate](#duplicate) - [extend](#extend) - [Extract](#extract) - [extract](#extract) @@ -29,6 +28,7 @@ Added in v2.0.0 - [Semigroupoid](#semigroupoid) - [compose](#compose) - [combinators](#combinators) + - [duplicate](#duplicate) - [swap](#swap) - [destructors](#destructors) - [fst](#fst) @@ -82,16 +82,6 @@ Added in v2.0.0 # Extend -## duplicate - -**Signature** - -```ts -export declare const duplicate: (wa: [A, E]) => [[A, E], E] -``` - -Added in v2.0.0 - ## extend **Signature** @@ -175,6 +165,18 @@ Added in v2.0.0 # combinators +## duplicate + +Derivable from `Extend`. + +**Signature** + +```ts +export declare const duplicate: (wa: [A, E]) => [[A, E], E] +``` + +Added in v2.0.0 + ## swap **Signature** diff --git a/src/Array.ts b/src/Array.ts index 37900e335..1b96ecef5 100644 --- a/src/Array.ts +++ b/src/Array.ts @@ -136,14 +136,16 @@ export const range: (start: number, end: number) => Array = RA.range as export const replicate: (n: number, a: A) => Array = RA.replicate as any /** - * Removes one level of nesting + * Removes one level of nesting. + * + * Derivable from `Monad`. * * @example * import { flatten } from 'fp-ts/Array' * * assert.deepStrictEqual(flatten([[1], [2], [3]]), [1, 2, 3]) * - * @category Monad + * @category combinators * @since 2.0.0 */ export const flatten: (mma: Array>) => Array = RA.flatten as any @@ -1035,7 +1037,9 @@ export const ap: (fa: Array) => (fab: Array<(a: A) => B>) => Array = /** * Combine two effectful actions, keeping only the result of the first. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apFirst: (fb: Array) => (fa: Array) => Array = RA.apFirst as any @@ -1043,7 +1047,9 @@ export const apFirst: (fb: Array) => (fa: Array) => Array = RA.ap /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apSecond: (fb: Array) => (fa: Array) => Array = RA.apSecond as any @@ -1067,7 +1073,9 @@ export const chainWithIndex: ( * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const chainFirst: (f: (a: A) => Array) => (ma: Array) => Array = RA.chainFirst as any @@ -1174,7 +1182,9 @@ export const filterWithIndex: { export const extend: (f: (fa: Array) => B) => (wa: Array) => Array = RA.extend as any /** - * @category Extend + * Derivable from `Extend`. + * + * @category combinators * @since 2.0.0 */ export const duplicate: (wa: Array) => Array> = RA.duplicate as any diff --git a/src/Either.ts b/src/Either.ts index dfd701283..98906c385 100644 --- a/src/Either.ts +++ b/src/Either.ts @@ -415,7 +415,9 @@ export const ap: (fa: Either) => (fab: Either B>) => /** * Combine two effectful actions, keeping only the result of the first. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apFirst: (fb: Either) => (fa: Either) => Either = (fb) => @@ -427,7 +429,9 @@ export const apFirst: (fb: Either) => (fa: Either) => Eithe /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apSecond = (fb: Either): ((fa: Either) => Either) => @@ -471,7 +475,9 @@ export const chain: (f: (a: A) => Either) => (ma: Either) = /** * Less strict version of [`chainFirst`](#chainFirst) * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.8.0 */ export const chainFirstW: (f: (a: A) => Either) => (ma: Either) => Either = (f) => ( @@ -491,7 +497,9 @@ export const chainFirstW: (f: (a: A) => Either) => (ma: Either * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const chainFirst: (f: (a: A) => Either) => (ma: Either) => Either = chainFirstW @@ -499,6 +507,8 @@ export const chainFirst: (f: (a: A) => Either) => (ma: Either(f: (a: A) => Either) => (ma: Either(mma: Either>) => Either = @@ -531,7 +541,9 @@ export const extend: (f: (wa: Either) => B) => (wa: Either) isLeft(wa) ? wa : right(f(wa)) /** - * @category Extend + * Derivable from `Extend`. + * + * @category combinators * @since 2.0.0 */ export const duplicate: (ma: Either) => Either> = diff --git a/src/IO.ts b/src/IO.ts index 48a210f44..aed00478c 100644 --- a/src/IO.ts +++ b/src/IO.ts @@ -71,7 +71,9 @@ export const ap: (fa: IO) => (fab: IO<(a: A) => B>) => IO = (fa) => /** * Combine two effectful actions, keeping only the result of the first. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apFirst: (fb: IO) => (fa: IO) => IO = (fb) => @@ -83,7 +85,9 @@ export const apFirst: (fb: IO) => (fa: IO) => IO = (fb) => /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apSecond = (fb: IO): ((fa: IO) => IO) => @@ -112,7 +116,9 @@ export const chain: (f: (a: A) => IO) => (ma: IO) => IO = (f) => * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const chainFirst: (f: (a: A) => IO) => (ma: IO) => IO = (f) => @@ -124,7 +130,9 @@ export const chainFirst: (f: (a: A) => IO) => (ma: IO) => IO = (f ) /** - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const flatten: (mma: IO>) => IO = diff --git a/src/IOEither.ts b/src/IOEither.ts index bdfdb3920..4d2b147ea 100644 --- a/src/IOEither.ts +++ b/src/IOEither.ts @@ -270,7 +270,9 @@ export const ap: (fa: IOEither) => (fab: IOEither B> /** * Combine two effectful actions, keeping only the result of the first. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apFirst: (fb: IOEither) => (fa: IOEither) => IOEither = (fb) => @@ -282,7 +284,9 @@ export const apFirst: (fb: IOEither) => (fa: IOEither) => I /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apSecond = (fb: IOEither): ((fa: IOEither) => IOEither) => @@ -321,7 +325,9 @@ export const chain: (f: (a: A) => IOEither) => (ma: IOEither(f: (a: A) => IOEither) => (ma: IOEither) => IOEither = ( @@ -338,13 +344,17 @@ export const chainFirstW: (f: (a: A) => IOEither) => (ma: IOEi * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const chainFirst: (f: (a: A) => IOEither) => (ma: IOEither) => IOEither = chainFirstW /** - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const flatten: (mma: IOEither>) => IOEither = @@ -635,6 +645,8 @@ export const ioEither: Monad2 & Bifunctor2 & Alt2 & MonadIO2 * * (\*) i.e. returns a `Left` * + * Derivable from `MonadThrow`. + * * @since 2.0.0 */ export const bracket = ( diff --git a/src/Identity.ts b/src/Identity.ts index c034a04a5..0c7ce3ff7 100644 --- a/src/Identity.ts +++ b/src/Identity.ts @@ -76,7 +76,9 @@ export const ap: (fa: Identity) => (fab: Identity<(a: A) => B>) => Iden /** * Combine two effectful actions, keeping only the result of the first. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apFirst: (fb: Identity) => (fa: Identity) => Identity = (fb) => @@ -88,7 +90,9 @@ export const apFirst: (fb: Identity) => (fa: Identity) => Identity(fb: Identity): ((fa: Identity) => Identity) => @@ -117,7 +121,9 @@ export const chain: (f: (a: A) => Identity) => (ma: Identity) => Ide * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const chainFirst: (f: (a: A) => Identity) => (ma: Identity) => Identity = (f) => @@ -141,7 +147,9 @@ export const extend: (f: (wa: Identity) => B) => (wa: Identity) => I export const extract: (wa: Identity) => A = id /** - * @category Extend + * Derivable from `Extend`. + * + * @category combinators * @since 2.0.0 */ export const duplicate: (ma: Identity) => Identity> = @@ -149,7 +157,9 @@ export const duplicate: (ma: Identity) => Identity> = extend(id) /** - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const flatten: (mma: Identity>) => Identity = diff --git a/src/NonEmptyArray.ts b/src/NonEmptyArray.ts index 0fb43a3c4..a3a13a741 100644 --- a/src/NonEmptyArray.ts +++ b/src/NonEmptyArray.ts @@ -378,7 +378,9 @@ export const ap: (fa: NonEmptyArray) => (fab: NonEmptyArray<(a: A) => B /** * Combine two effectful actions, keeping only the result of the first. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apFirst: (fb: NonEmptyArray) => (fa: NonEmptyArray) => NonEmptyArray = RNEA.apFirst as any @@ -386,7 +388,9 @@ export const apFirst: (fb: NonEmptyArray) => (fa: NonEmptyArray) => /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apSecond: (fb: NonEmptyArray) => (fa: NonEmptyArray) => NonEmptyArray = RNEA.apSecond as any @@ -405,7 +409,9 @@ export const chain: ( * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const chainFirst: ( @@ -413,7 +419,9 @@ export const chainFirst: ( ) => (ma: NonEmptyArray) => NonEmptyArray = RNEA.chainFirst as any /** - * @category Extend + * Derivable from `Extend`. + * + * @category combinators * @since 2.0.0 */ export const duplicate: (ma: NonEmptyArray) => NonEmptyArray> = RNEA.duplicate as any @@ -427,7 +435,9 @@ export const extend: ( ) => (ma: NonEmptyArray) => NonEmptyArray = RNEA.extend as any /** - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const flatten: (mma: NonEmptyArray>) => NonEmptyArray = RNEA.flatten as any diff --git a/src/Option.ts b/src/Option.ts index 237d16034..d37634487 100644 --- a/src/Option.ts +++ b/src/Option.ts @@ -451,7 +451,9 @@ export const ap: (fa: Option) => (fab: Option<(a: A) => B>) => Option(fb: Option) => (fa: Option) => Option = (fb) => @@ -463,7 +465,9 @@ export const apFirst: (fb: Option) => (fa: Option) => Option = (f /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apSecond = (fb: Option): ((fa: Option) => Option) => @@ -493,7 +497,9 @@ export const chain: (f: (a: A) => Option) => (ma: Option) => Option< * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const chainFirst: (f: (a: A) => Option) => (ma: Option) => Option = (f) => @@ -505,7 +511,9 @@ export const chainFirst: (f: (a: A) => Option) => (ma: Option) => Op ) /** - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const flatten: (mma: Option>) => Option = @@ -563,7 +571,9 @@ export const extend: (f: (wa: Option) => B) => (wa: Option) => Optio isNone(wa) ? none : some(f(wa)) /** - * @category Extend + * Derivable from `Extend`. + * + * @category combinators * @since 2.0.0 */ export const duplicate: (ma: Option) => Option> = diff --git a/src/Reader.ts b/src/Reader.ts index 769219882..1c0fcf5b1 100644 --- a/src/Reader.ts +++ b/src/Reader.ts @@ -111,7 +111,9 @@ export const ap: (fa: Reader) => (fab: Reader B>) => /** * Combine two effectful actions, keeping only the result of the first. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apFirst: (fb: Reader) => (fa: Reader) => Reader = (fb) => @@ -123,7 +125,9 @@ export const apFirst: (fb: Reader) => (fa: Reader) => Reade /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apSecond = (fb: Reader): ((fa: Reader) => Reader) => @@ -162,7 +166,9 @@ export const chain: (f: (a: A) => Reader) => (ma: Reader) = * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const chainFirst: (f: (a: A) => Reader) => (ma: Reader) => Reader = (f) => @@ -174,7 +180,9 @@ export const chainFirst: (f: (a: A) => Reader) => (ma: Reader(mma: Reader>) => Reader = diff --git a/src/ReaderEither.ts b/src/ReaderEither.ts index cfb0f53e1..db21a2711 100644 --- a/src/ReaderEither.ts +++ b/src/ReaderEither.ts @@ -289,7 +289,9 @@ export const ap: ( /** * Combine two effectful actions, keeping only the result of the first. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apFirst: ( @@ -303,7 +305,9 @@ export const apFirst: ( /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apSecond = ( @@ -347,7 +351,9 @@ export const chain: ( /** * Less strict version of [`chainFirst`](#chainFirst) * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.8.0 */ export const chainFirstW: ( @@ -364,7 +370,9 @@ export const chainFirstW: ( * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const chainFirst: ( @@ -372,7 +380,9 @@ export const chainFirst: ( ) => (ma: ReaderEither) => ReaderEither = chainFirstW /** - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const flatten: (mma: ReaderEither>) => ReaderEither = diff --git a/src/ReaderTask.ts b/src/ReaderTask.ts index 7633cc75e..7439b5ec3 100644 --- a/src/ReaderTask.ts +++ b/src/ReaderTask.ts @@ -156,7 +156,9 @@ export const ap: (fa: ReaderTask) => (fab: ReaderTask(fb: ReaderTask) => (fa: ReaderTask) => ReaderTask = (fb) => @@ -168,7 +170,9 @@ export const apFirst: (fb: ReaderTask) => (fa: ReaderTask) /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.3.0 */ export const apSecond = (fb: ReaderTask): ((fa: ReaderTask) => ReaderTask) => @@ -211,7 +215,9 @@ export const chain: (f: (a: A) => ReaderTask) => (ma: ReaderTask< * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.3.0 */ export const chainFirst: (f: (a: A) => ReaderTask) => (ma: ReaderTask) => ReaderTask = (f) => @@ -223,7 +229,9 @@ export const chainFirst: (f: (a: A) => ReaderTask) => (ma: Reader ) /** - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.3.0 */ export const flatten: (mma: ReaderTask>) => ReaderTask = diff --git a/src/ReaderTaskEither.ts b/src/ReaderTaskEither.ts index a134137e1..66e901165 100644 --- a/src/ReaderTaskEither.ts +++ b/src/ReaderTaskEither.ts @@ -438,7 +438,9 @@ export const ap: ( /** * Combine two effectful actions, keeping only the result of the first. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apFirst: ( @@ -452,7 +454,9 @@ export const apFirst: ( /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apSecond = ( @@ -500,7 +504,9 @@ export const chain: ( /** * Less strict version of [`chainFirst`](#chainFirst). * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.8.0 */ export const chainFirstW: ( @@ -517,7 +523,9 @@ export const chainFirstW: ( * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const chainFirst: ( @@ -525,7 +533,9 @@ export const chainFirst: ( ) => (ma: ReaderTaskEither) => ReaderTaskEither = chainFirstW /** - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const flatten: (mma: ReaderTaskEither>) => ReaderTaskEither = @@ -792,6 +802,8 @@ export function run(ma: ReaderTaskEither, r: R): Promise( diff --git a/src/ReadonlyArray.ts b/src/ReadonlyArray.ts index 104d52116..5ab786bb0 100644 --- a/src/ReadonlyArray.ts +++ b/src/ReadonlyArray.ts @@ -225,12 +225,14 @@ export function replicate(n: number, a: A): ReadonlyArray { /** * Removes one level of nesting * + * Derivable from `Monad`. + * * @example * import { flatten } from 'fp-ts/ReadonlyArray' * * assert.deepStrictEqual(flatten([[1], [2], [3]]), [1, 2, 3]) * - * @category Monad + * @category combinators * @since 2.5.0 */ export function flatten(mma: ReadonlyArray>): ReadonlyArray { @@ -1533,7 +1535,9 @@ export const ap: (fa: ReadonlyArray) => (fab: ReadonlyArray<(a: A) => B /** * Combine two effectful actions, keeping only the result of the first. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.5.0 */ export const apFirst: (fb: ReadonlyArray) => (fa: ReadonlyArray) => ReadonlyArray = (fb) => @@ -1545,7 +1549,9 @@ export const apFirst: (fb: ReadonlyArray) => (fa: ReadonlyArray) => /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.5.0 */ export const apSecond = (fb: ReadonlyArray): ((fa: ReadonlyArray) => ReadonlyArray) => @@ -1598,7 +1604,9 @@ export const chainWithIndex: ( * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.5.0 */ export const chainFirst: (f: (a: A) => ReadonlyArray) => (ma: ReadonlyArray) => ReadonlyArray = (f) => @@ -1788,7 +1796,9 @@ export const extend: (f: (fa: ReadonlyArray) => B) => (wa: ReadonlyArra ) => wa.map((_, i, as) => f(as.slice(i))) /** - * @category Extend + * Derivable from `Extend`. + * + * @category combinators * @since 2.5.0 */ export const duplicate: (wa: ReadonlyArray) => ReadonlyArray> = diff --git a/src/ReadonlyNonEmptyArray.ts b/src/ReadonlyNonEmptyArray.ts index a6b2312f9..59f39a695 100644 --- a/src/ReadonlyNonEmptyArray.ts +++ b/src/ReadonlyNonEmptyArray.ts @@ -443,7 +443,9 @@ export const ap: ( /** * Combine two effectful actions, keeping only the result of the first. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.5.0 */ export const apFirst: ( @@ -453,7 +455,9 @@ export const apFirst: ( /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.5.0 */ export const apSecond: ( @@ -474,7 +478,9 @@ export const chain: ( * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.5.0 */ export const chainFirst: ( @@ -482,7 +488,9 @@ export const chainFirst: ( ) => (ma: ReadonlyNonEmptyArray) => ReadonlyNonEmptyArray = RA.chainFirst as any /** - * @category Extend + * Derivable from `Extend`. + * + * @category combinators * @since 2.5.0 */ export const duplicate: ( @@ -498,7 +506,9 @@ export const extend: ( ) => (ma: ReadonlyNonEmptyArray) => ReadonlyNonEmptyArray = RA.extend as any /** - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.5.0 */ export const flatten: ( diff --git a/src/ReadonlyTuple.ts b/src/ReadonlyTuple.ts index 73e787969..e908bccb0 100644 --- a/src/ReadonlyTuple.ts +++ b/src/ReadonlyTuple.ts @@ -223,7 +223,9 @@ export const extend: (f: (wa: readonly [A, E]) => B) => (wa: readonly [ export const extract: (wa: readonly [A, E]) => A = fst /** - * @category Extend + * Derivable from `Extend`. + * + * @category combinators * @since 2.5.0 */ export const duplicate: (wa: readonly [A, E]) => readonly [readonly [A, E], E] = diff --git a/src/State.ts b/src/State.ts index 21380d7b0..626fc7286 100644 --- a/src/State.ts +++ b/src/State.ts @@ -98,7 +98,9 @@ export const ap: (fa: State) => (fab: State B>) => S /** * Combine two effectful actions, keeping only the result of the first. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apFirst: (fb: State) => (fa: State) => State = (fb) => @@ -110,7 +112,9 @@ export const apFirst: (fb: State) => (fa: State) => State(fb: State): ((fa: State) => State) => @@ -142,7 +146,9 @@ export const chain: (f: (a: A) => State) => (ma: State) => * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const chainFirst: (f: (a: A) => State) => (ma: State) => State = (f) => @@ -154,7 +160,9 @@ export const chainFirst: (f: (a: A) => State) => (ma: State ) /** - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const flatten: (mma: State>) => State = diff --git a/src/StateReaderTaskEither.ts b/src/StateReaderTaskEither.ts index 023173733..fa63b6d27 100644 --- a/src/StateReaderTaskEither.ts +++ b/src/StateReaderTaskEither.ts @@ -467,7 +467,9 @@ export const ap: ( /** * Combine two effectful actions, keeping only the result of the first. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apFirst: ( @@ -481,7 +483,9 @@ export const apFirst: ( /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apSecond = ( @@ -527,7 +531,9 @@ export const chain: ( /** * Less strict version of [`chainFirst`](#chainFirst). * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.8.0 */ export const chainFirstW: ( @@ -544,7 +550,9 @@ export const chainFirstW: ( * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const chainFirst: ( @@ -552,7 +560,9 @@ export const chainFirst: ( ) => (ma: StateReaderTaskEither) => StateReaderTaskEither = chainFirstW /** - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const flatten: ( diff --git a/src/Store.ts b/src/Store.ts index ae4021df9..5965dc6d3 100644 --- a/src/Store.ts +++ b/src/Store.ts @@ -101,7 +101,9 @@ export const extend: (f: (wa: Store) => B) => (wa: Store) = export const extract: (wa: Store) => A = (wa) => wa.peek(wa.pos) /** - * @category Extend + * Derivable from `Extend`. + * + * @category combinators * @since 2.0.0 */ export const duplicate: (wa: Store) => Store> = diff --git a/src/Task.ts b/src/Task.ts index 06142ba8c..c775beb7c 100644 --- a/src/Task.ts +++ b/src/Task.ts @@ -135,7 +135,9 @@ export const ap: (fa: Task) => (fab: Task<(a: A) => B>) => Task = (f /** * Combine two effectful actions, keeping only the result of the first. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apFirst: (fb: Task) => (fa: Task) => Task = (fb) => @@ -147,7 +149,9 @@ export const apFirst: (fb: Task) => (fa: Task) => Task = (fb) => /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apSecond = (fb: Task): ((fa: Task) => Task) => @@ -177,7 +181,9 @@ export const chain: (f: (a: A) => Task) => (ma: Task) => Task = ( * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const chainFirst: (f: (a: A) => Task) => (ma: Task) => Task = (f) => @@ -189,7 +195,9 @@ export const chainFirst: (f: (a: A) => Task) => (ma: Task) => Task(mma: Task>) => Task = diff --git a/src/TaskEither.ts b/src/TaskEither.ts index 93cd8dd9c..b5eef35d2 100644 --- a/src/TaskEither.ts +++ b/src/TaskEither.ts @@ -374,7 +374,9 @@ export const ap: (fa: TaskEither) => (fab: TaskEither(fb: TaskEither) => (fa: TaskEither) => TaskEither = (fb) => @@ -386,7 +388,9 @@ export const apFirst: (fb: TaskEither) => (fa: TaskEither) /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apSecond = (fb: TaskEither): ((fa: TaskEither) => TaskEither) => @@ -415,7 +419,9 @@ export const chain: (f: (a: A) => TaskEither) => (ma: TaskEither< /** * Less strict version of [`chainFirst`](#chainFirst). * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.8.0 */ export const chainFirstW: ( @@ -432,7 +438,9 @@ export const chainFirstW: ( * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const chainFirst: ( @@ -440,7 +448,9 @@ export const chainFirst: ( ) => (ma: TaskEither) => TaskEither = chainFirstW /** - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const flatten: (mma: TaskEither>) => TaskEither = @@ -821,6 +831,8 @@ export function taskify(f: Function): () => TaskEither { * * (\*) i.e. returns a `Left` * + * Derivable from `MonadThrow`. + * * @since 2.0.0 */ export const bracket = ( diff --git a/src/Tree.ts b/src/Tree.ts index 10c064f99..76f435704 100644 --- a/src/Tree.ts +++ b/src/Tree.ts @@ -300,7 +300,9 @@ export const ap: (fa: Tree) => (fab: Tree<(a: A) => B>) => Tree = (f /** * Combine two effectful actions, keeping only the result of the first. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apFirst: (fb: Tree) => (fa: Tree) => Tree = (fb) => @@ -312,7 +314,9 @@ export const apFirst: (fb: Tree) => (fa: Tree) => Tree = (fb) => /** * Combine two effectful actions, keeping only the result of the second. * - * @category Apply + * Derivable from `Apply`. + * + * @category combinators * @since 2.0.0 */ export const apSecond = (fb: Tree): ((fa: Tree) => Tree) => @@ -340,7 +344,9 @@ export const chain = (f: (a: A) => Tree) => (ma: Tree): Tree => { * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const chainFirst: (f: (a: A) => Tree) => (ma: Tree) => Tree = (f) => @@ -361,7 +367,9 @@ export const extend: (f: (wa: Tree) => B) => (wa: Tree) => Tree = }) /** - * @category Extend + * Derivable from `Extend`. + * + * @category combinators * @since 2.0.0 */ export const duplicate: (wa: Tree) => Tree> = @@ -369,7 +377,9 @@ export const duplicate: (wa: Tree) => Tree> = extend(identity) /** - * @category Monad + * Derivable from `Monad`. + * + * @category combinators * @since 2.0.0 */ export const flatten: (mma: Tree>) => Tree = diff --git a/src/Tuple.ts b/src/Tuple.ts index 5fd0f462c..d0783f122 100644 --- a/src/Tuple.ts +++ b/src/Tuple.ts @@ -113,7 +113,9 @@ export const mapLeft: (f: (e: E) => G) => (fa: [A, E]) => [A, G] = RT.m export const compose: (ab: [B, A]) => (bc: [C, B]) => [C, A] = RT.compose as any /** - * @category Extend + * Derivable from `Extend`. + * + * @category combinators * @since 2.0.0 */ export const duplicate: (wa: [A, E]) => [[A, E], E] = RT.duplicate as any