From 435fe155ac898980734b2de6600151cecf099a6b Mon Sep 17 00:00:00 2001 From: gcanti Date: Fri, 30 Sep 2022 18:38:29 +0200 Subject: [PATCH] remove last instance references (hopefully) --- docs/modules/Const.ts.md | 30 +-- docs/modules/Eq.ts.md | 113 +++++----- docs/modules/IOEither.ts.md | 86 ++++---- docs/modules/Ord.ts.md | 113 +++++----- docs/modules/Predicate.ts.md | 27 ++- docs/modules/Reader.ts.md | 260 +++++++++++------------ docs/modules/ReaderEither.ts.md | 94 ++++---- docs/modules/ReaderIO.ts.md | 67 +++--- docs/modules/ReaderTask.ts.md | 73 +++---- docs/modules/ReaderTaskEither.ts.md | 94 ++++---- docs/modules/ReadonlyTuple.ts.md | 27 ++- docs/modules/StateReaderTaskEither.ts.md | 90 ++++---- docs/modules/TaskEither.ts.md | 204 +++++++++--------- docs/modules/Tuple.ts.md | 27 ++- src/Const.ts | 1 - src/Eq.ts | 1 - src/IOEither.ts | 3 +- src/Ord.ts | 1 - src/Predicate.ts | 1 - src/Reader.ts | 19 +- src/ReaderEither.ts | 4 +- src/ReaderIO.ts | 3 +- src/ReaderTask.ts | 3 +- src/ReaderTaskEither.ts | 4 +- src/ReadonlyTuple.ts | 1 - src/StateReaderTaskEither.ts | 4 +- src/TaskEither.ts | 5 +- src/Tuple.ts | 1 - 28 files changed, 639 insertions(+), 717 deletions(-) diff --git a/docs/modules/Const.ts.md b/docs/modules/Const.ts.md index fe643e076..58e8afd15 100644 --- a/docs/modules/Const.ts.md +++ b/docs/modules/Const.ts.md @@ -18,15 +18,13 @@ Added in v2.0.0

Table of contents

-- [Contravariant](#contravariant) - - [contramap](#contramap) - [constructors](#constructors) - [make](#make) - [error handling](#error-handling) - [mapLeft](#mapleft) - [instances](#instances) - [Bifunctor](#bifunctor) - - [Contravariant](#contravariant-1) + - [Contravariant](#contravariant) - [Functor](#functor) - [getApplicative](#getapplicative) - [getApply](#getapply) @@ -49,23 +47,13 @@ Added in v2.0.0 - [type lambdas](#type-lambdas) - [URI](#uri) - [URI (type alias)](#uri-type-alias) +- [utils](#utils) + - [contramap](#contramap) - [zone of death](#zone-of-death) - [~~const\_~~](#const_) --- -# Contravariant - -## contramap - -**Signature** - -```ts -export declare const contramap: (f: (b: B) => A) => (fa: Const) => Const -``` - -Added in v2.0.0 - # constructors ## make @@ -315,6 +303,18 @@ export type URI = typeof URI Added in v2.0.0 +# utils + +## contramap + +**Signature** + +```ts +export declare const contramap: (f: (b: B) => A) => (fa: Const) => Const +``` + +Added in v2.0.0 + # zone of death ## ~~const\_~~ diff --git a/docs/modules/Eq.ts.md b/docs/modules/Eq.ts.md index e0e63b10c..c6a36b8c2 100644 --- a/docs/modules/Eq.ts.md +++ b/docs/modules/Eq.ts.md @@ -20,12 +20,10 @@ Added in v2.0.0

Table of contents

-- [Contravariant](#contravariant) - - [contramap](#contramap) - [constructors](#constructors) - [fromEquals](#fromequals) - [instances](#instances) - - [Contravariant](#contravariant-1) + - [Contravariant](#contravariant) - [eqStrict](#eqstrict) - [getMonoid](#getmonoid) - [getSemigroup](#getsemigroup) @@ -35,6 +33,7 @@ Added in v2.0.0 - [URI](#uri) - [URI (type alias)](#uri-type-alias) - [utils](#utils) + - [contramap](#contramap) - [struct](#struct) - [tuple](#tuple) - [zone of death](#zone-of-death) @@ -49,61 +48,6 @@ Added in v2.0.0 --- -# Contravariant - -## contramap - -A typical use case for `contramap` would be like, given some `User` type, to construct an `Eq`. - -We can do so with a function from `User -> X` where `X` is some value that we know how to compare -for equality (meaning we have an `Eq`) - -For example, given the following `User` type, we want to construct an `Eq` that just looks at the `key` field -for each user (since it's known to be unique). - -If we have a way of comparing `UUID`s for equality (`eqUUID: Eq`) and we know how to go from `User -> UUID`, -using `contramap` we can do this - -**Signature** - -```ts -export declare const contramap: (f: (b: B) => A) => (fa: Eq) => Eq -``` - -**Example** - -```ts -import { contramap, Eq } from 'fp-ts/Eq' -import { pipe } from 'fp-ts/function' -import * as S from 'fp-ts/string' - -type UUID = string - -interface User { - readonly key: UUID - readonly firstName: string - readonly lastName: string -} - -const eqUUID: Eq = S.Eq - -const eqUserByKey: Eq = pipe( - eqUUID, - contramap((user) => user.key) -) - -assert.deepStrictEqual( - eqUserByKey.equals({ key: 'k1', firstName: 'a1', lastName: 'b1' }, { key: 'k2', firstName: 'a1', lastName: 'b1' }), - false -) -assert.deepStrictEqual( - eqUserByKey.equals({ key: 'k1', firstName: 'a1', lastName: 'b1' }, { key: 'k1', firstName: 'a2', lastName: 'b1' }), - true -) -``` - -Added in v2.0.0 - # constructors ## fromEquals @@ -196,6 +140,59 @@ Added in v2.0.0 # utils +## contramap + +A typical use case for `contramap` would be like, given some `User` type, to construct an `Eq`. + +We can do so with a function from `User -> X` where `X` is some value that we know how to compare +for equality (meaning we have an `Eq`) + +For example, given the following `User` type, we want to construct an `Eq` that just looks at the `key` field +for each user (since it's known to be unique). + +If we have a way of comparing `UUID`s for equality (`eqUUID: Eq`) and we know how to go from `User -> UUID`, +using `contramap` we can do this + +**Signature** + +```ts +export declare const contramap: (f: (b: B) => A) => (fa: Eq) => Eq +``` + +**Example** + +```ts +import { contramap, Eq } from 'fp-ts/Eq' +import { pipe } from 'fp-ts/function' +import * as S from 'fp-ts/string' + +type UUID = string + +interface User { + readonly key: UUID + readonly firstName: string + readonly lastName: string +} + +const eqUUID: Eq = S.Eq + +const eqUserByKey: Eq = pipe( + eqUUID, + contramap((user) => user.key) +) + +assert.deepStrictEqual( + eqUserByKey.equals({ key: 'k1', firstName: 'a1', lastName: 'b1' }, { key: 'k2', firstName: 'a1', lastName: 'b1' }), + false +) +assert.deepStrictEqual( + eqUserByKey.equals({ key: 'k1', firstName: 'a1', lastName: 'b1' }, { key: 'k1', firstName: 'a2', lastName: 'b1' }), + true +) +``` + +Added in v2.0.0 + ## struct **Signature** diff --git a/docs/modules/IOEither.ts.md b/docs/modules/IOEither.ts.md index 297502cf8..0535eb97d 100644 --- a/docs/modules/IOEither.ts.md +++ b/docs/modules/IOEither.ts.md @@ -18,10 +18,6 @@ Added in v2.0.0

Table of contents

-- [Apply](#apply) - - [apW](#apw) -- [MonadThrow](#monadthrow) - - [throwError](#throwerror) - [constructors](#constructors) - [left](#left) - [leftIO](#leftio) @@ -51,6 +47,7 @@ Added in v2.0.0 - [mapLeft](#mapleft) - [orElse](#orelse) - [orElseFirst](#orelsefirst) + - [orElseFirstIOK](#orelsefirstiok) - [orElseFirstW](#orelsefirstw) - [orElseW](#orelsew) - [orLeft](#orleft) @@ -71,7 +68,7 @@ Added in v2.0.0 - [Functor](#functor) - [Monad](#monad) - [MonadIO](#monadio) - - [MonadThrow](#monadthrow-1) + - [MonadThrow](#monadthrow) - [Pointed](#pointed) - [interop](#interop) - [tryCatch](#trycatch) @@ -119,12 +116,13 @@ Added in v2.0.0 - [apFirstW](#apfirstw) - [apSecond](#apsecond) - [apSecondW](#apsecondw) + - [apW](#apw) - [bracket](#bracket) - [bracketW](#bracketw) - - [orElseFirstIOK](#orelsefirstiok) - [sequenceArray](#sequencearray) - [sequenceSeqArray](#sequenceseqarray) - [swap](#swap) + - [throwError](#throwerror) - [traverseArray](#traversearray) - [traverseArrayWithIndex](#traversearraywithindex) - [traverseReadonlyArrayWithIndex](#traversereadonlyarraywithindex) @@ -143,36 +141,6 @@ Added in v2.0.0 --- -# Apply - -## apW - -Less strict version of [`ap`](#ap). - -The `W` suffix (short for **W**idening) means that the error types will be merged. - -**Signature** - -```ts -export declare const apW: ( - fa: IOEither -) => (fab: IOEither B>) => IOEither -``` - -Added in v2.8.0 - -# MonadThrow - -## throwError - -**Signature** - -```ts -export declare const throwError: (e: E) => IOEither -``` - -Added in v2.7.0 - # constructors ## left @@ -475,6 +443,16 @@ export declare const orElseFirst: (onLeft: (e: E) => IOEither) =>
(onLeft: (e: E) => I.IO) => (ma: IOEither) => IOEither +``` + +Added in v2.12.0 + ## orElseFirstW The `W` suffix (short for **W**idening) means that the error types will be merged. @@ -1201,6 +1179,22 @@ export declare const apSecondW: ( Added in v2.12.0 +## apW + +Less strict version of [`ap`](#ap). + +The `W` suffix (short for **W**idening) means that the error types will be merged. + +**Signature** + +```ts +export declare const apW: ( + fa: IOEither +) => (fab: IOEither B>) => IOEither +``` + +Added in v2.8.0 + ## bracket Make sure that a resource is cleaned up in the event of an exception (\*). The release action is called regardless of @@ -1238,16 +1232,6 @@ export declare const bracketW: ( Added in v2.12.0 -## orElseFirstIOK - -**Signature** - -```ts -export declare const orElseFirstIOK: (onLeft: (e: E) => I.IO) => (ma: IOEither) => IOEither -``` - -Added in v2.12.0 - ## sequenceArray **Signature** @@ -1278,6 +1262,16 @@ export declare const swap: (ma: IOEither) => IOEither Added in v2.0.0 +## throwError + +**Signature** + +```ts +export declare const throwError: (e: E) => IOEither +``` + +Added in v2.7.0 + ## traverseArray **Signature** diff --git a/docs/modules/Ord.ts.md b/docs/modules/Ord.ts.md index 031d7e322..4d3e413c9 100644 --- a/docs/modules/Ord.ts.md +++ b/docs/modules/Ord.ts.md @@ -20,14 +20,12 @@ Added in v2.0.0

Table of contents

-- [Contravariant](#contravariant) - - [contramap](#contramap) - [constructors](#constructors) - [fromCompare](#fromcompare) - [defaults](#defaults) - [equalsDefault](#equalsdefault) - [instances](#instances) - - [Contravariant](#contravariant-1) + - [Contravariant](#contravariant) - [getMonoid](#getmonoid) - [getSemigroup](#getsemigroup) - [model](#model) @@ -38,6 +36,7 @@ Added in v2.0.0 - [utils](#utils) - [between](#between) - [clamp](#clamp) + - [contramap](#contramap) - [equals](#equals) - [geq](#geq) - [gt](#gt) @@ -59,61 +58,6 @@ Added in v2.0.0 --- -# Contravariant - -## contramap - -A typical use case for `contramap` would be like, given some `User` type, to construct an `Ord`. - -We can do so with a function from `User -> X` where `X` is some value that we know how to compare -for ordering (meaning we have an `Ord`) - -For example, given the following `User` type, there are lots of possible choices for `X`, -but let's say we want to sort a list of users by `lastName`. - -If we have a way of comparing `lastName`s for ordering (`ordLastName: Ord`) and we know how to go from `User -> string`, -using `contramap` we can do this - -**Signature** - -```ts -export declare const contramap: (f: (b: B) => A) => (fa: Ord
) => Ord -``` - -**Example** - -```ts -import { pipe } from 'fp-ts/function' -import { contramap, Ord } from 'fp-ts/Ord' -import * as RA from 'fp-ts/ReadonlyArray' -import * as S from 'fp-ts/string' - -interface User { - readonly firstName: string - readonly lastName: string -} - -const ordLastName: Ord = S.Ord - -const ordByLastName: Ord = pipe( - ordLastName, - contramap((user) => user.lastName) -) - -assert.deepStrictEqual( - RA.sort(ordByLastName)([ - { firstName: 'a', lastName: 'd' }, - { firstName: 'c', lastName: 'b' }, - ]), - [ - { firstName: 'c', lastName: 'b' }, - { firstName: 'a', lastName: 'd' }, - ] -) -``` - -Added in v2.0.0 - # constructors ## fromCompare @@ -344,6 +288,59 @@ export declare const clamp: (O: Ord) => (low: A, hi: A) => (a: A) => A Added in v2.0.0 +## contramap + +A typical use case for `contramap` would be like, given some `User` type, to construct an `Ord`. + +We can do so with a function from `User -> X` where `X` is some value that we know how to compare +for ordering (meaning we have an `Ord`) + +For example, given the following `User` type, there are lots of possible choices for `X`, +but let's say we want to sort a list of users by `lastName`. + +If we have a way of comparing `lastName`s for ordering (`ordLastName: Ord`) and we know how to go from `User -> string`, +using `contramap` we can do this + +**Signature** + +```ts +export declare const contramap: (f: (b: B) => A) => (fa: Ord) => Ord +``` + +**Example** + +```ts +import { pipe } from 'fp-ts/function' +import { contramap, Ord } from 'fp-ts/Ord' +import * as RA from 'fp-ts/ReadonlyArray' +import * as S from 'fp-ts/string' + +interface User { + readonly firstName: string + readonly lastName: string +} + +const ordLastName: Ord = S.Ord + +const ordByLastName: Ord = pipe( + ordLastName, + contramap((user) => user.lastName) +) + +assert.deepStrictEqual( + RA.sort(ordByLastName)([ + { firstName: 'a', lastName: 'd' }, + { firstName: 'c', lastName: 'b' }, + ]), + [ + { firstName: 'c', lastName: 'b' }, + { firstName: 'a', lastName: 'd' }, + ] +) +``` + +Added in v2.0.0 + ## equals **Signature** diff --git a/docs/modules/Predicate.ts.md b/docs/modules/Predicate.ts.md index a232a0329..921cf0bfa 100644 --- a/docs/modules/Predicate.ts.md +++ b/docs/modules/Predicate.ts.md @@ -12,10 +12,8 @@ Added in v2.11.0

Table of contents

-- [Contravariant](#contravariant) - - [contramap](#contramap) - [instances](#instances) - - [Contravariant](#contravariant-1) + - [Contravariant](#contravariant) - [getMonoidAll](#getmonoidall) - [getMonoidAny](#getmonoidany) - [getSemigroupAll](#getsemigroupall) @@ -26,23 +24,12 @@ Added in v2.11.0 - [utils](#utils) - [Predicate (interface)](#predicate-interface) - [and](#and) + - [contramap](#contramap) - [not](#not) - [or](#or) --- -# Contravariant - -## contramap - -**Signature** - -```ts -export declare const contramap: (f: (b: B) => A) => (predicate: Predicate
) => Predicate -``` - -Added in v2.11.0 - # instances ## Contravariant @@ -141,6 +128,16 @@ export declare const and: (second: Predicate) => (first: Predicate) => Added in v2.11.0 +## contramap + +**Signature** + +```ts +export declare const contramap: (f: (b: B) => A) => (predicate: Predicate) => Predicate +``` + +Added in v2.11.0 + ## not **Signature** diff --git a/docs/modules/Reader.ts.md b/docs/modules/Reader.ts.md index 08ac78c04..cde3a962c 100644 --- a/docs/modules/Reader.ts.md +++ b/docs/modules/Reader.ts.md @@ -54,39 +54,32 @@ Added in v2.0.0

Table of contents

-- [Apply](#apply) - - [apW](#apw) -- [Category](#category) - - [id](#id) -- [Choice](#choice) - - [left](#left) - - [right](#right) -- [Profunctor](#profunctor) - - [promap](#promap) -- [Semigroupoid](#semigroupoid) - - [compose](#compose) -- [Strong](#strong) - - [first](#first) - - [second](#second) - [constructors](#constructors) - [ask](#ask) - [asks](#asks) + - [asksReader](#asksreader) + - [asksReaderW](#asksreaderw) + - [id](#id) - [of](#of) - [do notation](#do-notation) - [Do](#do) - [apS](#aps) - [apSW](#apsw) + - [bind](#bind) + - [bindTo](#bindto) + - [bindW](#bindw) + - [let](#let) - [instances](#instances) - [Applicative](#applicative) - - [Apply](#apply-1) - - [Category](#category-1) + - [Apply](#apply) + - [Category](#category) - [Chain](#chain) - - [Choice](#choice-1) + - [Choice](#choice) - [Functor](#functor) - [Monad](#monad) - [Pointed](#pointed) - - [Profunctor](#profunctor-1) - - [Strong](#strong-1) + - [Profunctor](#profunctor) + - [Strong](#strong) - [mapping](#mapping) - [flap](#flap) - [map](#map) @@ -110,13 +103,14 @@ Added in v2.0.0 - [apFirstW](#apfirstw) - [apSecond](#apsecond) - [apSecondW](#apsecondw) - - [asksReader](#asksreader) - - [asksReaderW](#asksreaderw) - - [bind](#bind) - - [bindTo](#bindto) - - [bindW](#bindw) - - [let](#let) + - [apW](#apw) + - [compose](#compose) + - [first](#first) + - [left](#left) - [local](#local) + - [promap](#promap) + - [right](#right) + - [second](#second) - [sequenceArray](#sequencearray) - [traverseArray](#traversearray) - [traverseArrayWithIndex](#traversearraywithindex) @@ -129,179 +123,170 @@ Added in v2.0.0 --- -# Apply - -## apW +# constructors -Less strict version of [`ap`](#ap). +## ask -The `W` suffix (short for **W**idening) means that the environment types will be merged. +Reads the current context **Signature** ```ts -export declare const apW: (fa: Reader) => (fab: Reader B>) => Reader +export declare const ask: () => Reader ``` -Added in v2.8.0 +Added in v2.0.0 -# Category +## asks -## id +Projects a value from the global context in a Reader **Signature** ```ts -export declare const id:
() => Reader +export declare const asks: (f: (r: R) => A) => Reader ``` Added in v2.0.0 -# Choice +## asksReader -## left +Effectfully accesses the environment. **Signature** ```ts -export declare const left: (pab: Reader) => Reader, E.Either> +export declare const asksReader: (f: (r: R) => Reader) => Reader ``` -Added in v2.10.0 +Added in v2.11.0 -## right +## asksReaderW + +Less strict version of [`asksReader`](#asksreader). + +The `W` suffix (short for **W**idening) means that the environment types will be merged. **Signature** ```ts -export declare const right: (pbc: Reader) => Reader, E.Either> +export declare const asksReaderW: (f: (r1: R1) => Reader) => Reader ``` -Added in v2.10.0 - -# Profunctor +Added in v2.11.0 -## promap +## id **Signature** ```ts -export declare const promap: (f: (d: D) => E, g: (a: A) => B) => (fea: Reader) => Reader +export declare const id: () => Reader ``` Added in v2.0.0 -# Semigroupoid - -## compose +## of **Signature** ```ts -export declare const compose: (ab: Reader) => (bc: Reader) => Reader +export declare const of: (a: A) => Reader ``` Added in v2.0.0 -# Strong +# do notation -## first +## Do **Signature** ```ts -export declare const first: (pab: Reader) => Reader<[A, C], [B, C]> +export declare const Do: Reader ``` -Added in v2.10.0 +Added in v2.9.0 -## second +## apS **Signature** ```ts -export declare const second: (pab: Reader) => Reader<[A, B], [A, C]> +export declare const apS: ( + name: Exclude, + fb: Reader +) => (fa: Reader) => Reader ``` -Added in v2.10.0 +Added in v2.8.0 -# constructors +## apSW -## ask +Less strict version of [`apS`](#aps). -Reads the current context +The `W` suffix (short for **W**idening) means that the environment types will be merged. **Signature** ```ts -export declare const ask: () => Reader +export declare const apSW: ( + name: Exclude, + fb: Reader +) => (fa: Reader) => Reader ``` -Added in v2.0.0 - -## asks +Added in v2.8.0 -Projects a value from the global context in a Reader +## bind **Signature** ```ts -export declare const asks: (f: (r: R) => A) => Reader +export declare const bind: ( + name: Exclude, + f: (a: A) => Reader +) => (ma: Reader) => Reader ``` -Added in v2.0.0 +Added in v2.8.0 -## of +## bindTo **Signature** ```ts -export declare const of: (a: A) => Reader +export declare const bindTo: (name: N) => (fa: Reader) => Reader ``` -Added in v2.0.0 - -# do notation - -## Do - -**Signature** - -```ts -export declare const Do: Reader -``` +Added in v2.8.0 -Added in v2.9.0 +## bindW -## apS +The `W` suffix (short for **W**idening) means that the environment types will be merged. **Signature** ```ts -export declare const apS: ( +export declare const bindW: ( name: Exclude, - fb: Reader -) => (fa: Reader) => Reader + f: (a: A) => Reader +) => (fa: Reader) => Reader ``` Added in v2.8.0 -## apSW - -Less strict version of [`apS`](#aps). - -The `W` suffix (short for **W**idening) means that the environment types will be merged. +## let **Signature** ```ts -export declare const apSW: ( +export declare const let: ( name: Exclude, - fb: Reader -) => (fa: Reader) => Reader + f: (a: A) => B +) => (fa: Reader) => Reader ``` -Added in v2.8.0 +Added in v2.13.0 # instances @@ -623,82 +608,49 @@ export declare const apSecondW: (second: Reader) => (first: Added in v2.12.0 -## asksReader - -Effectfully accesses the environment. - -**Signature** - -```ts -export declare const asksReader: (f: (r: R) => Reader) => Reader -``` - -Added in v2.11.0 - -## asksReaderW +## apW -Less strict version of [`asksReader`](#asksreader). +Less strict version of [`ap`](#ap). The `W` suffix (short for **W**idening) means that the environment types will be merged. **Signature** ```ts -export declare const asksReaderW: (f: (r1: R1) => Reader) => Reader -``` - -Added in v2.11.0 - -## bind - -**Signature** - -```ts -export declare const bind: ( - name: Exclude, - f: (a: A) => Reader -) => (ma: Reader) => Reader +export declare const apW: (fa: Reader) => (fab: Reader B>) => Reader ``` Added in v2.8.0 -## bindTo +## compose **Signature** ```ts -export declare const bindTo: (name: N) => (fa: Reader) => Reader +export declare const compose: (ab: Reader) => (bc: Reader) => Reader ``` -Added in v2.8.0 - -## bindW +Added in v2.0.0 -The `W` suffix (short for **W**idening) means that the environment types will be merged. +## first **Signature** ```ts -export declare const bindW: ( - name: Exclude, - f: (a: A) => Reader -) => (fa: Reader) => Reader +export declare const first: (pab: Reader) => Reader<[A, C], [B, C]> ``` -Added in v2.8.0 +Added in v2.10.0 -## let +## left **Signature** ```ts -export declare const let: ( - name: Exclude, - f: (a: A) => B -) => (fa: Reader) => Reader +export declare const left: (pab: Reader) => Reader, E.Either> ``` -Added in v2.13.0 +Added in v2.10.0 ## local @@ -740,6 +692,36 @@ assert.deepStrictEqual( Added in v2.0.0 +## promap + +**Signature** + +```ts +export declare const promap: (f: (d: D) => E, g: (a: A) => B) => (fea: Reader) => Reader +``` + +Added in v2.0.0 + +## right + +**Signature** + +```ts +export declare const right: (pbc: Reader) => Reader, E.Either> +``` + +Added in v2.10.0 + +## second + +**Signature** + +```ts +export declare const second: (pab: Reader) => Reader<[A, B], [A, C]> +``` + +Added in v2.10.0 + ## sequenceArray **Signature** diff --git a/docs/modules/ReaderEither.ts.md b/docs/modules/ReaderEither.ts.md index 6edda9351..7fc0548ab 100644 --- a/docs/modules/ReaderEither.ts.md +++ b/docs/modules/ReaderEither.ts.md @@ -12,13 +12,11 @@ Added in v2.0.0

Table of contents

-- [Apply](#apply) - - [apW](#apw) -- [MonadThrow](#monadthrow) - - [throwError](#throwerror) - [constructors](#constructors) - [ask](#ask) - [asks](#asks) + - [asksReaderEither](#asksreadereither) + - [asksReaderEitherW](#asksreadereitherw) - [left](#left) - [leftReader](#leftreader) - [of](#of) @@ -58,14 +56,14 @@ Added in v2.0.0 - [instances](#instances) - [Alt](#alt) - [Applicative](#applicative) - - [Apply](#apply-1) + - [Apply](#apply) - [Bifunctor](#bifunctor) - [Chain](#chain) - [FromEither](#fromeither) - [FromReader](#fromreader) - [Functor](#functor) - [Monad](#monad) - - [MonadThrow](#monadthrow-1) + - [MonadThrow](#monadthrow) - [Pointed](#pointed) - [lifting](#lifting) - [fromEitherK](#fromeitherk) @@ -112,11 +110,11 @@ Added in v2.0.0 - [apFirstW](#apfirstw) - [apSecond](#apsecond) - [apSecondW](#apsecondw) - - [asksReaderEither](#asksreadereither) - - [asksReaderEitherW](#asksreadereitherw) + - [apW](#apw) - [local](#local) - [sequenceArray](#sequencearray) - [swap](#swap) + - [throwError](#throwerror) - [traverseArray](#traversearray) - [traverseArrayWithIndex](#traversearraywithindex) - [traverseReadonlyArrayWithIndex](#traversereadonlyarraywithindex) @@ -130,61 +128,59 @@ Added in v2.0.0 --- -# Apply - -## apW +# constructors -Less strict version of [`ap`](#ap). +## ask -The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged. +Reads the current context. **Signature** ```ts -export declare const apW: ( - fa: ReaderEither -) => (fab: ReaderEither B>) => ReaderEither +export declare const ask: () => ReaderEither ``` -Added in v2.8.0 +Added in v2.0.0 -# MonadThrow +## asks -## throwError +Projects a value from the global context in a `ReaderEither`. **Signature** ```ts -export declare const throwError: (e: E) => ReaderEither +export declare const asks: (f: (r: R) => A) => ReaderEither ``` -Added in v2.7.0 - -# constructors +Added in v2.0.0 -## ask +## asksReaderEither -Reads the current context. +Effectfully accesses the environment. **Signature** ```ts -export declare const ask: () => ReaderEither +export declare const asksReaderEither: (f: (r: R) => ReaderEither) => ReaderEither ``` -Added in v2.0.0 +Added in v2.11.0 -## asks +## asksReaderEitherW -Projects a value from the global context in a `ReaderEither`. +Less strict version of [`asksReaderEither`](#asksreadereither). + +The `W` suffix (short for **W**idening) means that the environment types will be merged. **Signature** ```ts -export declare const asks: (f: (r: R) => A) => ReaderEither +export declare const asksReaderEitherW: ( + f: (r1: R1) => ReaderEither +) => ReaderEither ``` -Added in v2.0.0 +Added in v2.11.0 ## left @@ -1243,33 +1239,21 @@ export declare const apSecondW: ( Added in v2.12.0 -## asksReaderEither - -Effectfully accesses the environment. - -**Signature** - -```ts -export declare const asksReaderEither: (f: (r: R) => ReaderEither) => ReaderEither -``` - -Added in v2.11.0 - -## asksReaderEitherW +## apW -Less strict version of [`asksReaderEither`](#asksreadereither). +Less strict version of [`ap`](#ap). -The `W` suffix (short for **W**idening) means that the environment types will be merged. +The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged. **Signature** ```ts -export declare const asksReaderEitherW: ( - f: (r1: R1) => ReaderEither -) => ReaderEither +export declare const apW: ( + fa: ReaderEither +) => (fab: ReaderEither B>) => ReaderEither ``` -Added in v2.11.0 +Added in v2.8.0 ## local @@ -1304,6 +1288,16 @@ export declare const swap: (ma: ReaderEither) => ReaderEither< Added in v2.0.0 +## throwError + +**Signature** + +```ts +export declare const throwError: (e: E) => ReaderEither +``` + +Added in v2.7.0 + ## traverseArray **Signature** diff --git a/docs/modules/ReaderIO.ts.md b/docs/modules/ReaderIO.ts.md index ff3396275..822de003f 100644 --- a/docs/modules/ReaderIO.ts.md +++ b/docs/modules/ReaderIO.ts.md @@ -12,11 +12,11 @@ Added in v2.13.0

Table of contents

-- [Apply](#apply) - - [apW](#apw) - [constructors](#constructors) - [ask](#ask) - [asks](#asks) + - [asksReaderIO](#asksreaderio) + - [asksReaderIOW](#asksreaderiow) - [of](#of) - [conversions](#conversions) - [fromIO](#fromio) @@ -30,7 +30,7 @@ Added in v2.13.0 - [bindW](#bindw) - [instances](#instances) - [Applicative](#applicative) - - [Apply](#apply-1) + - [Apply](#apply) - [Chain](#chain) - [FromIO](#fromio) - [FromReader](#fromreader) @@ -68,8 +68,7 @@ Added in v2.13.0 - [ap](#ap) - [apFirst](#apfirst) - [apSecond](#apsecond) - - [asksReaderIO](#asksreaderio) - - [asksReaderIOW](#asksreaderiow) + - [apW](#apw) - [local](#local) - [sequenceArray](#sequencearray) - [traverseArray](#traversearray) @@ -79,46 +78,54 @@ Added in v2.13.0 --- -# Apply - -## apW +# constructors -Less strict version of [`ap`](#ap). +## ask -The `W` suffix (short for **W**idening) means that the environment types will be merged. +Reads the current context. **Signature** ```ts -export declare const apW: ( - fa: ReaderIO -) => (fab: ReaderIO B>) => ReaderIO +export declare const ask: () => ReaderIO ``` Added in v2.13.0 -# constructors +## asks -## ask +Projects a value from the global context in a `ReaderIO`. -Reads the current context. +**Signature** + +```ts +export declare const asks: (f: (r: R) => A) => ReaderIO +``` + +Added in v2.13.0 + +## asksReaderIO + +Effectfully accesses the environment. **Signature** ```ts -export declare const ask: () => ReaderIO +export declare const asksReaderIO: (f: (r: R) => ReaderIO) => ReaderIO ``` Added in v2.13.0 -## asks +## asksReaderIOW -Projects a value from the global context in a `ReaderIO`. +Less strict version of [`asksReaderIO`](#asksreaderio). + +The `W` suffix (short for **W**idening) means that the environment types will be merged. **Signature** ```ts -export declare const asks: (f: (r: R) => A) => ReaderIO +export declare const asksReaderIOW: (f: (r1: R1) => ReaderIO) => ReaderIO ``` Added in v2.13.0 @@ -617,28 +624,18 @@ export declare const apSecond: (second: ReaderIO) =>
(first: Read Added in v2.13.0 -## asksReaderIO - -Effectfully accesses the environment. - -**Signature** - -```ts -export declare const asksReaderIO: (f: (r: R) => ReaderIO) => ReaderIO -``` - -Added in v2.13.0 - -## asksReaderIOW +## apW -Less strict version of [`asksReaderIO`](#asksreaderio). +Less strict version of [`ap`](#ap). The `W` suffix (short for **W**idening) means that the environment types will be merged. **Signature** ```ts -export declare const asksReaderIOW: (f: (r1: R1) => ReaderIO) => ReaderIO +export declare const apW: ( + fa: ReaderIO +) => (fab: ReaderIO B>) => ReaderIO ``` Added in v2.13.0 diff --git a/docs/modules/ReaderTask.ts.md b/docs/modules/ReaderTask.ts.md index 5b513b123..ae3fee760 100644 --- a/docs/modules/ReaderTask.ts.md +++ b/docs/modules/ReaderTask.ts.md @@ -12,11 +12,11 @@ Added in v2.3.0

Table of contents

-- [Apply](#apply) - - [apW](#apw) - [constructors](#constructors) - [ask](#ask) - [asks](#asks) + - [asksReaderTask](#asksreadertask) + - [asksReaderTaskW](#asksreadertaskw) - [of](#of) - [conversions](#conversions) - [fromIO](#fromio) @@ -83,8 +83,7 @@ Added in v2.3.0 - [ap](#ap) - [apFirst](#apfirst) - [apSecond](#apsecond) - - [asksReaderTask](#asksreadertask) - - [asksReaderTaskW](#asksreadertaskw) + - [apW](#apw) - [local](#local) - [sequenceArray](#sequencearray) - [traverseArray](#traversearray) @@ -105,24 +104,6 @@ Added in v2.3.0 --- -# Apply - -## apW - -Less strict version of [`ap`](#ap). - -The `W` suffix (short for **W**idening) means that the environment types will be merged. - -**Signature** - -```ts -export declare const apW: ( - fa: ReaderTask -) => (fab: ReaderTask B>) => ReaderTask -``` - -Added in v2.8.0 - # constructors ## ask @@ -149,6 +130,32 @@ export declare const asks: (f: (r: R) => A) => ReaderTask Added in v2.3.0 +## asksReaderTask + +Effectfully accesses the environment. + +**Signature** + +```ts +export declare const asksReaderTask: (f: (r: R) => ReaderTask) => ReaderTask +``` + +Added in v2.11.0 + +## asksReaderTaskW + +Less strict version of [`asksReaderTask`](#asksreadertask). + +The `W` suffix (short for **W**idening) means that the environment types will be merged. + +**Signature** + +```ts +export declare const asksReaderTaskW: (f: (r1: R1) => ReaderTask) => ReaderTask +``` + +Added in v2.11.0 + ## of **Signature** @@ -824,31 +831,21 @@ export declare const apSecond: (second: ReaderTask) =>
(first: Re Added in v2.3.0 -## asksReaderTask - -Effectfully accesses the environment. - -**Signature** - -```ts -export declare const asksReaderTask: (f: (r: R) => ReaderTask) => ReaderTask -``` - -Added in v2.11.0 - -## asksReaderTaskW +## apW -Less strict version of [`asksReaderTask`](#asksreadertask). +Less strict version of [`ap`](#ap). The `W` suffix (short for **W**idening) means that the environment types will be merged. **Signature** ```ts -export declare const asksReaderTaskW: (f: (r1: R1) => ReaderTask) => ReaderTask +export declare const apW: ( + fa: ReaderTask +) => (fab: ReaderTask B>) => ReaderTask ``` -Added in v2.11.0 +Added in v2.8.0 ## local diff --git a/docs/modules/ReaderTaskEither.ts.md b/docs/modules/ReaderTaskEither.ts.md index b6532bff2..5d41a6d62 100644 --- a/docs/modules/ReaderTaskEither.ts.md +++ b/docs/modules/ReaderTaskEither.ts.md @@ -12,13 +12,11 @@ Added in v2.0.0

Table of contents

-- [Apply](#apply) - - [apW](#apw) -- [MonadThrow](#monadthrow) - - [throwError](#throwerror) - [constructors](#constructors) - [ask](#ask) - [asks](#asks) + - [asksReaderTaskEither](#asksreadertaskeither) + - [asksReaderTaskEitherW](#asksreadertaskeitherw) - [left](#left) - [leftIO](#leftio) - [leftReader](#leftreader) @@ -85,7 +83,7 @@ Added in v2.0.0 - [Monad](#monad) - [MonadIO](#monadio) - [MonadTask](#monadtask) - - [MonadThrow](#monadthrow-1) + - [MonadThrow](#monadthrow) - [Pointed](#pointed) - [~~getReaderTaskValidation~~](#getreadertaskvalidation) - [lifting](#lifting) @@ -164,14 +162,14 @@ Added in v2.0.0 - [apFirstW](#apfirstw) - [apSecond](#apsecond) - [apSecondW](#apsecondw) - - [asksReaderTaskEither](#asksreadertaskeither) - - [asksReaderTaskEitherW](#asksreadertaskeitherw) + - [apW](#apw) - [bracket](#bracket) - [bracketW](#bracketw) - [local](#local) - [sequenceArray](#sequencearray) - [sequenceSeqArray](#sequenceseqarray) - [swap](#swap) + - [throwError](#throwerror) - [traverseArray](#traversearray) - [traverseArrayWithIndex](#traversearraywithindex) - [traverseReadonlyArrayWithIndex](#traversereadonlyarraywithindex) @@ -190,61 +188,61 @@ Added in v2.0.0 --- -# Apply - -## apW +# constructors -Less strict version of [`ap`](#ap). +## ask -The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged. +Reads the current context. **Signature** ```ts -export declare const apW: ( - fa: ReaderTaskEither -) => (fab: ReaderTaskEither B>) => ReaderTaskEither +export declare const ask: () => ReaderTaskEither ``` -Added in v2.8.0 +Added in v2.0.0 -# MonadThrow +## asks -## throwError +Projects a value from the global context in a `ReaderEither`. **Signature** ```ts -export declare const throwError: (e: E) => ReaderTaskEither +export declare const asks: (f: (r: R) => A) => ReaderTaskEither ``` Added in v2.0.0 -# constructors - -## ask +## asksReaderTaskEither -Reads the current context. +Effectfully accesses the environment. **Signature** ```ts -export declare const ask: () => ReaderTaskEither +export declare const asksReaderTaskEither: ( + f: (r: R) => ReaderTaskEither +) => ReaderTaskEither ``` -Added in v2.0.0 +Added in v2.11.0 -## asks +## asksReaderTaskEitherW -Projects a value from the global context in a `ReaderEither`. +Less strict version of [`asksReaderTaskEither`](#asksreadertaskeither). + +The `W` suffix (short for **W**idening) means that the environment types will be merged. **Signature** ```ts -export declare const asks: (f: (r: R) => A) => ReaderTaskEither +export declare const asksReaderTaskEitherW: ( + f: (r1: R1) => ReaderTaskEither +) => ReaderTaskEither ``` -Added in v2.0.0 +Added in v2.11.0 ## left @@ -1947,35 +1945,21 @@ export declare const apSecondW: ( Added in v2.12.0 -## asksReaderTaskEither - -Effectfully accesses the environment. - -**Signature** - -```ts -export declare const asksReaderTaskEither: ( - f: (r: R) => ReaderTaskEither -) => ReaderTaskEither -``` - -Added in v2.11.0 - -## asksReaderTaskEitherW +## apW -Less strict version of [`asksReaderTaskEither`](#asksreadertaskeither). +Less strict version of [`ap`](#ap). -The `W` suffix (short for **W**idening) means that the environment types will be merged. +The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged. **Signature** ```ts -export declare const asksReaderTaskEitherW: ( - f: (r1: R1) => ReaderTaskEither -) => ReaderTaskEither +export declare const apW: ( + fa: ReaderTaskEither +) => (fab: ReaderTaskEither B>) => ReaderTaskEither ``` -Added in v2.11.0 +Added in v2.8.0 ## bracket @@ -2061,6 +2045,16 @@ export declare const swap: (ma: ReaderTaskEither) => ReaderTas Added in v2.0.0 +## throwError + +**Signature** + +```ts +export declare const throwError: (e: E) => ReaderTaskEither +``` + +Added in v2.0.0 + ## traverseArray **Signature** diff --git a/docs/modules/ReadonlyTuple.ts.md b/docs/modules/ReadonlyTuple.ts.md index a5e82ff2f..77d18d935 100644 --- a/docs/modules/ReadonlyTuple.ts.md +++ b/docs/modules/ReadonlyTuple.ts.md @@ -14,8 +14,6 @@ Added in v2.5.0 - [Extract](#extract) - [extract](#extract) -- [Semigroupoid](#semigroupoid) - - [compose](#compose) - [error handling](#error-handling) - [mapLeft](#mapleft) - [folding](#folding) @@ -27,7 +25,7 @@ Added in v2.5.0 - [Comonad](#comonad) - [Foldable](#foldable) - [Functor](#functor) - - [Semigroupoid](#semigroupoid-1) + - [Semigroupoid](#semigroupoid) - [Traversable](#traversable) - [getApplicative](#getapplicative) - [getApply](#getapply) @@ -47,6 +45,7 @@ Added in v2.5.0 - [URI](#uri) - [URI (type alias)](#uri-type-alias) - [utils](#utils) + - [compose](#compose) - [duplicate](#duplicate) - [extend](#extend) - [fst](#fst) @@ -69,18 +68,6 @@ export declare const extract: (wa: readonly [A, E]) => A Added in v2.6.2 -# Semigroupoid - -## compose - -**Signature** - -```ts -export declare const compose: (ab: readonly [B, A]) => (bc: readonly [C, B]) => readonly [C, A] -``` - -Added in v2.5.0 - # error handling ## mapLeft @@ -352,6 +339,16 @@ Added in v2.5.0 # utils +## compose + +**Signature** + +```ts +export declare const compose: (ab: readonly [B, A]) => (bc: readonly [C, B]) => readonly [C, A] +``` + +Added in v2.5.0 + ## duplicate **Signature** diff --git a/docs/modules/StateReaderTaskEither.ts.md b/docs/modules/StateReaderTaskEither.ts.md index 9106ed3c5..9eec312e6 100644 --- a/docs/modules/StateReaderTaskEither.ts.md +++ b/docs/modules/StateReaderTaskEither.ts.md @@ -12,13 +12,11 @@ Added in v2.0.0

Table of contents

-- [Apply](#apply) - - [apW](#apw) -- [MonadThrow](#monadthrow) - - [throwError](#throwerror) - [constructors](#constructors) - [ask](#ask) - [asks](#asks) + - [asksStateReaderTaskEither](#asksstatereadertaskeither) + - [asksStateReaderTaskEitherW](#asksstatereadertaskeitherw) - [fromReaderTaskEither](#fromreadertaskeither) - [get](#get) - [gets](#gets) @@ -57,7 +55,7 @@ Added in v2.0.0 - [instances](#instances) - [Alt](#alt) - [Applicative](#applicative) - - [Apply](#apply-1) + - [Apply](#apply) - [Bifunctor](#bifunctor) - [Chain](#chain) - [FromEither](#fromeither) @@ -69,7 +67,7 @@ Added in v2.0.0 - [Monad](#monad) - [MonadIO](#monadio) - [MonadTask](#monadtask) - - [MonadThrow](#monadthrow-1) + - [MonadThrow](#monadthrow) - [Pointed](#pointed) - [lifting](#lifting) - [fromEitherK](#fromeitherk) @@ -125,8 +123,7 @@ Added in v2.0.0 - [apS](#aps) - [apSecond](#apsecond) - [apSecondW](#apsecondw) - - [asksStateReaderTaskEither](#asksstatereadertaskeither) - - [asksStateReaderTaskEitherW](#asksstatereadertaskeitherw) + - [apW](#apw) - [bind](#bind) - [bindTo](#bindto) - [bindW](#bindw) @@ -135,6 +132,7 @@ Added in v2.0.0 - [let](#let) - [local](#local) - [sequenceArray](#sequencearray) + - [throwError](#throwerror) - [traverseArray](#traversearray) - [traverseArrayWithIndex](#traversearraywithindex) - [traverseReadonlyArrayWithIndex](#traversereadonlyarraywithindex) @@ -148,58 +146,56 @@ Added in v2.0.0 --- -# Apply - -## apW +# constructors -Less strict version of [`ap`](#ap). +## ask -The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged. +Reads the current context. **Signature** ```ts -export declare const apW: ( - fa: StateReaderTaskEither -) => (fab: StateReaderTaskEither B>) => StateReaderTaskEither +export declare const ask: () => StateReaderTaskEither ``` -Added in v2.8.0 +Added in v2.11.0 -# MonadThrow +## asks -## throwError +Projects a value from the global context in a `ReaderEither`. **Signature** ```ts -export declare const throwError: (e: E) => StateReaderTaskEither +export declare const asks: (f: (r: R) => A) => StateReaderTaskEither ``` -Added in v2.7.0 - -# constructors +Added in v2.11.0 -## ask +## asksStateReaderTaskEither -Reads the current context. +Effectfully accesses the environment. **Signature** ```ts -export declare const ask: () => StateReaderTaskEither +export declare const asksStateReaderTaskEither: ( + f: (r: R) => StateReaderTaskEither +) => StateReaderTaskEither ``` Added in v2.11.0 -## asks +## asksStateReaderTaskEitherW -Projects a value from the global context in a `ReaderEither`. +Less strict version of [`asksStateReaderTaskEither`](#asksstatereadertaskeither). **Signature** ```ts -export declare const asks: (f: (r: R) => A) => StateReaderTaskEither +export declare const asksStateReaderTaskEitherW: ( + f: (r1: R1) => StateReaderTaskEither +) => StateReaderTaskEither ``` Added in v2.11.0 @@ -1400,33 +1396,21 @@ export declare const apSecondW: ( Added in v2.12.0 -## asksStateReaderTaskEither - -Effectfully accesses the environment. - -**Signature** - -```ts -export declare const asksStateReaderTaskEither: ( - f: (r: R) => StateReaderTaskEither -) => StateReaderTaskEither -``` - -Added in v2.11.0 +## apW -## asksStateReaderTaskEitherW +Less strict version of [`ap`](#ap). -Less strict version of [`asksStateReaderTaskEither`](#asksstatereadertaskeither). +The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged. **Signature** ```ts -export declare const asksStateReaderTaskEitherW: ( - f: (r1: R1) => StateReaderTaskEither -) => StateReaderTaskEither +export declare const apW: ( + fa: StateReaderTaskEither +) => (fab: StateReaderTaskEither B>) => StateReaderTaskEither ``` -Added in v2.11.0 +Added in v2.8.0 ## bind @@ -1542,6 +1526,16 @@ export declare const sequenceArray: ( Added in v2.9.0 +## throwError + +**Signature** + +```ts +export declare const throwError: (e: E) => StateReaderTaskEither +``` + +Added in v2.7.0 + ## traverseArray **Signature** diff --git a/docs/modules/TaskEither.ts.md b/docs/modules/TaskEither.ts.md index 8838821bf..3a321e555 100644 --- a/docs/modules/TaskEither.ts.md +++ b/docs/modules/TaskEither.ts.md @@ -19,10 +19,6 @@ Added in v2.0.0

Table of contents

-- [Apply](#apply) - - [apW](#apw) -- [MonadTask](#monadtask) - - [throwError](#throwerror) - [constructors](#constructors) - [left](#left) - [leftIO](#leftio) @@ -58,6 +54,8 @@ Added in v2.0.0 - [mapLeft](#mapleft) - [orElse](#orelse) - [orElseFirst](#orelsefirst) + - [orElseFirstIOK](#orelsefirstiok) + - [orElseFirstTaskK](#orelsefirsttaskk) - [orElseFirstW](#orelsefirstw) - [orElseW](#orelsew) - [orLeft](#orleft) @@ -80,10 +78,11 @@ Added in v2.0.0 - [Functor](#functor) - [Monad](#monad) - [MonadIO](#monadio) - - [MonadTask](#monadtask-1) + - [MonadTask](#monadtask) - [MonadThrow](#monadthrow) - [Pointed](#pointed) - [interop](#interop) + - [taskify](#taskify) - [tryCatch](#trycatch) - [tryCatchK](#trycatchk) - [lifting](#lifting) @@ -140,14 +139,13 @@ Added in v2.0.0 - [apFirstW](#apfirstw) - [apSecond](#apsecond) - [apSecondW](#apsecondw) + - [apW](#apw) - [bracket](#bracket) - [bracketW](#bracketw) - - [orElseFirstIOK](#orelsefirstiok) - - [orElseFirstTaskK](#orelsefirsttaskk) - [sequenceArray](#sequencearray) - [sequenceSeqArray](#sequenceseqarray) - [swap](#swap) - - [taskify](#taskify) + - [throwError](#throwerror) - [traverseArray](#traversearray) - [traverseArrayWithIndex](#traversearraywithindex) - [traverseReadonlyArrayWithIndex](#traversereadonlyarraywithindex) @@ -166,36 +164,6 @@ Added in v2.0.0 --- -# Apply - -## apW - -Less strict version of [`ap`](#ap). - -The `W` suffix (short for **W**idening) means that the error types will be merged. - -**Signature** - -```ts -export declare const apW: ( - fa: TaskEither -) => (fab: TaskEither B>) => TaskEither -``` - -Added in v2.8.0 - -# MonadTask - -## throwError - -**Signature** - -```ts -export declare const throwError: (e: E) => TaskEither -``` - -Added in v2.7.0 - # constructors ## left @@ -666,6 +634,28 @@ export declare const orElseFirst: ( Added in v2.11.0 +## orElseFirstIOK + +**Signature** + +```ts +export declare const orElseFirstIOK: (onLeft: (e: E) => IO) =>
(ma: TaskEither) => TaskEither +``` + +Added in v2.12.0 + +## orElseFirstTaskK + +**Signature** + +```ts +export declare const orElseFirstTaskK: ( + onLeft: (e: E) => T.Task +) => (ma: TaskEither) => TaskEither +``` + +Added in v2.12.0 + ## orElseFirstW The `W` suffix (short for **W**idening) means that the error types will be merged. @@ -936,6 +926,58 @@ Added in v2.10.0 # interop +## taskify + +Convert a node style callback function to one returning a `TaskEither` + +**Note**. If the function `f` admits multiple overloadings, `taskify` will pick last one. If you want a different +behaviour, add an explicit type annotation + +```ts +// readFile admits multiple overloadings + +// const readFile: (a: string) => TaskEither +const readFile = taskify(fs.readFile) + +const readFile2: (filename: string, encoding: string) => TaskEither = taskify( + fs.readFile +) +``` + +**Signature** + +```ts +export declare function taskify(f: (cb: (e: L | null | undefined, r?: R) => void) => void): () => TaskEither +export declare function taskify( + f: (a: A, cb: (e: L | null | undefined, r?: R) => void) => void +): (a: A) => TaskEither +export declare function taskify( + f: (a: A, b: B, cb: (e: L | null | undefined, r?: R) => void) => void +): (a: A, b: B) => TaskEither +export declare function taskify( + f: (a: A, b: B, c: C, cb: (e: L | null | undefined, r?: R) => void) => void +): (a: A, b: B, c: C) => TaskEither +export declare function taskify( + f: (a: A, b: B, c: C, d: D, cb: (e: L | null | undefined, r?: R) => void) => void +): (a: A, b: B, c: C, d: D) => TaskEither +export declare function taskify( + f: (a: A, b: B, c: C, d: D, e: E, cb: (e: L | null | undefined, r?: R) => void) => void +): (a: A, b: B, c: C, d: D, e: E) => TaskEither +``` + +**Example** + +```ts +import { taskify } from 'fp-ts/TaskEither' +import * as fs from 'fs' + +// const stat: (a: string | Buffer) => TaskEither +const stat = taskify(fs.stat) +assert.strictEqual(stat.length, 0) +``` + +Added in v2.0.0 + ## tryCatch Transforms a `Promise` that may reject to a `Promise` that never rejects and returns an `Either` instead. @@ -1578,6 +1620,22 @@ export declare const apSecondW: ( Added in v2.12.0 +## apW + +Less strict version of [`ap`](#ap). + +The `W` suffix (short for **W**idening) means that the error types will be merged. + +**Signature** + +```ts +export declare const apW: ( + fa: TaskEither +) => (fab: TaskEither B>) => TaskEither +``` + +Added in v2.8.0 + ## bracket Make sure that a resource is cleaned up in the event of an exception (\*). The release action is called regardless of @@ -1615,28 +1673,6 @@ export declare const bracketW: ( Added in v2.12.0 -## orElseFirstIOK - -**Signature** - -```ts -export declare const orElseFirstIOK: (onLeft: (e: E) => IO) => (ma: TaskEither) => TaskEither -``` - -Added in v2.12.0 - -## orElseFirstTaskK - -**Signature** - -```ts -export declare const orElseFirstTaskK: ( - onLeft: (e: E) => T.Task -) => (ma: TaskEither) => TaskEither -``` - -Added in v2.12.0 - ## sequenceArray **Signature** @@ -1667,57 +1703,15 @@ export declare const swap: (ma: TaskEither) => TaskEither Added in v2.0.0 -## taskify - -Convert a node style callback function to one returning a `TaskEither` - -**Note**. If the function `f` admits multiple overloadings, `taskify` will pick last one. If you want a different -behaviour, add an explicit type annotation - -```ts -// readFile admits multiple overloadings - -// const readFile: (a: string) => TaskEither -const readFile = taskify(fs.readFile) - -const readFile2: (filename: string, encoding: string) => TaskEither = taskify( - fs.readFile -) -``` +## throwError **Signature** ```ts -export declare function taskify(f: (cb: (e: L | null | undefined, r?: R) => void) => void): () => TaskEither -export declare function taskify( - f: (a: A, cb: (e: L | null | undefined, r?: R) => void) => void -): (a: A) => TaskEither -export declare function taskify( - f: (a: A, b: B, cb: (e: L | null | undefined, r?: R) => void) => void -): (a: A, b: B) => TaskEither -export declare function taskify( - f: (a: A, b: B, c: C, cb: (e: L | null | undefined, r?: R) => void) => void -): (a: A, b: B, c: C) => TaskEither -export declare function taskify( - f: (a: A, b: B, c: C, d: D, cb: (e: L | null | undefined, r?: R) => void) => void -): (a: A, b: B, c: C, d: D) => TaskEither -export declare function taskify( - f: (a: A, b: B, c: C, d: D, e: E, cb: (e: L | null | undefined, r?: R) => void) => void -): (a: A, b: B, c: C, d: D, e: E) => TaskEither -``` - -**Example** - -```ts -import { taskify } from 'fp-ts/TaskEither' -import * as fs from 'fs' - -// const stat: (a: string | Buffer) => TaskEither -const stat = taskify(fs.stat) -assert.strictEqual(stat.length, 0) +export declare const throwError: (e: E) => TaskEither ``` -Added in v2.0.0 +Added in v2.7.0 ## traverseArray diff --git a/docs/modules/Tuple.ts.md b/docs/modules/Tuple.ts.md index fbc4528d0..f3b6783a0 100644 --- a/docs/modules/Tuple.ts.md +++ b/docs/modules/Tuple.ts.md @@ -14,8 +14,6 @@ Added in v2.0.0 - [Extract](#extract) - [extract](#extract) -- [Semigroupoid](#semigroupoid) - - [compose](#compose) - [folding](#folding) - [foldMap](#foldmap) - [reduce](#reduce) @@ -25,7 +23,7 @@ Added in v2.0.0 - [Comonad](#comonad) - [Foldable](#foldable) - [Functor](#functor) - - [Semigroupoid](#semigroupoid-1) + - [Semigroupoid](#semigroupoid) - [Traversable](#traversable) - [getApplicative](#getapplicative) - [getApply](#getapply) @@ -44,6 +42,7 @@ Added in v2.0.0 - [URI](#uri) - [URI (type alias)](#uri-type-alias) - [utils](#utils) + - [compose](#compose) - [duplicate](#duplicate) - [extend](#extend) - [fst](#fst) @@ -68,18 +67,6 @@ export declare const extract: (wa: [A, E]) => A Added in v2.6.2 -# Semigroupoid - -## compose - -**Signature** - -```ts -export declare const compose: (ab: [B, A]) => (bc: [C, B]) => [C, A] -``` - -Added in v2.0.0 - # folding ## foldMap @@ -322,6 +309,16 @@ Added in v2.0.0 # utils +## compose + +**Signature** + +```ts +export declare const compose: (ab: [B, A]) => (bc: [C, B]) => [C, A] +``` + +Added in v2.0.0 + ## duplicate **Signature** diff --git a/src/Const.ts b/src/Const.ts index abceaa723..3ad3e0a93 100644 --- a/src/Const.ts +++ b/src/Const.ts @@ -141,7 +141,6 @@ const _bimap: Bifunctor2['bimap'] = (fa, f, g) => pipe(fa, bimap(f, g)) const _mapLeft: Bifunctor2['mapLeft'] = (fa, f) => pipe(fa, mapLeft(f)) /** - * @category Contravariant * @since 2.0.0 */ export const contramap: (f: (b: B) => A) => (fa: Const) => Const = () => unsafeCoerce diff --git a/src/Eq.ts b/src/Eq.ts index 1163371d3..ff468a7e6 100644 --- a/src/Eq.ts +++ b/src/Eq.ts @@ -126,7 +126,6 @@ const contramap_: (fa: Eq, f: (b: B) => A) => Eq = (fa, f) => pipe(f * true * ) * - * @category Contravariant * @since 2.0.0 */ export const contramap: (f: (b: B) => A) => (fa: Eq) => Eq = (f) => (fa) => diff --git a/src/IOEither.ts b/src/IOEither.ts index ce24b5ca9..83c0fbc5c 100644 --- a/src/IOEither.ts +++ b/src/IOEither.ts @@ -262,6 +262,7 @@ export const orElseFirstW: ( ) => (ma: IOEither) => IOEither = orElseFirst as any /** + * @category error handling * @since 2.12.0 */ export const orElseFirstIOK: (onLeft: (e: E) => IO) => (ma: IOEither) => IOEither = (onLeft) => @@ -336,7 +337,6 @@ export const ap: (fa: IOEither) => (fab: IOEither B> * * The `W` suffix (short for **W**idening) means that the error types will be merged. * - * @category Apply * @since 2.8.0 */ export const apW: (fa: IOEither) => (fab: IOEither B>) => IOEither = @@ -408,7 +408,6 @@ export const altW: (that: Lazy>) => (fa: IOEither< alt as any /** - * @category MonadThrow * @since 2.7.0 */ export const throwError: MonadThrow2['throwError'] = left diff --git a/src/Ord.ts b/src/Ord.ts index 002c90cb3..896babdc6 100644 --- a/src/Ord.ts +++ b/src/Ord.ts @@ -135,7 +135,6 @@ const contramap_: (fa: Ord, f: (b: B) => A) => Ord = (fa, f) => pipe * ] * ) * - * @category Contravariant * @since 2.0.0 */ export const contramap: (f: (b: B) => A) => (fa: Ord) => Ord = (f) => (fa) => diff --git a/src/Predicate.ts b/src/Predicate.ts index e6c4203ff..07a4ce46c 100644 --- a/src/Predicate.ts +++ b/src/Predicate.ts @@ -20,7 +20,6 @@ export interface Predicate { const contramap_: Contravariant1['contramap'] = (predicate, f) => pipe(predicate, contramap(f)) /** - * @category Contravariant * @since 2.11.0 */ export const contramap = diff --git a/src/Reader.ts b/src/Reader.ts index 570090ea5..71ff171a7 100644 --- a/src/Reader.ts +++ b/src/Reader.ts @@ -130,6 +130,7 @@ export const local: (f: (r2: R2) => R1) => (ma: Reader) => Rea * * The `W` suffix (short for **W**idening) means that the environment types will be merged. * + * @category constructors * @since 2.11.0 */ export const asksReaderW = @@ -140,6 +141,7 @@ export const asksReaderW = /** * Effectfully accesses the environment. * + * @category constructors * @since 2.11.0 */ export const asksReader: (f: (r: R) => Reader) => Reader = asksReaderW @@ -167,7 +169,6 @@ export const map: (f: (a: A) => B) => (fa: Reader) => Reader(fa: Reader) => (fab: Reader B>) => Reader = @@ -223,13 +224,11 @@ export const flattenW: (mma: Reader>) => Reader(mma: Reader>) => Reader = flattenW /** - * @category Semigroupoid * @since 2.0.0 */ export const compose: (ab: Reader) => (bc: Reader) => Reader = (ab) => (bc) => flow(ab, bc) /** - * @category Profunctor * @since 2.0.0 */ export const promap: (f: (d: D) => E, g: (a: A) => B) => (fea: Reader) => Reader = @@ -237,13 +236,12 @@ export const promap: (f: (d: D) => E, g: (a: A) => B) => (fea: Reade g(fea(f(a))) /** - * @category Category + * @category constructors * @since 2.0.0 */ export const id: Category2['id'] = () => identity /** - * @category Strong * @since 2.10.0 */ export const first: Strong2['first'] = @@ -252,7 +250,6 @@ export const first: Strong2['first'] = [pab(a), c] /** - * @category Strong * @since 2.10.0 */ export const second: Strong2['second'] = @@ -261,13 +258,11 @@ export const second: Strong2['second'] = [a, pbc(b)] /** - * @category Choice * @since 2.10.0 */ export const left: Choice2['left'] = (pab) => E.fold((a) => _.left(pab(a)), E.right) /** - * @category Choice * @since 2.10.0 */ export const right: Choice2['right'] = (pbc) => E.fold(E.left, (b) => _.right(pbc(b))) @@ -462,6 +457,7 @@ export const Choice: Choice2 = { // ------------------------------------------------------------------------------------- /** + * @category do notation * @since 2.8.0 */ export const bindTo = /*#__PURE__*/ bindTo_(Functor) @@ -470,12 +466,14 @@ const let_ = /*#__PURE__*/ let__(Functor) export { /** + * @category do notation * @since 2.13.0 */ let_ as let } /** + * @category do notation * @since 2.8.0 */ export const bind = /*#__PURE__*/ bind_(Chain) @@ -483,6 +481,7 @@ export const bind = /*#__PURE__*/ bind_(Chain) /** * The `W` suffix (short for **W**idening) means that the environment types will be merged. * + * @category do notation * @since 2.8.0 */ export const bindW: ( @@ -491,10 +490,6 @@ export const bindW: ( ) => (fa: Reader) => Reader = bind as any -// ------------------------------------------------------------------------------------- -// pipeable sequence S -// ------------------------------------------------------------------------------------- - /** * @category do notation * @since 2.9.0 diff --git a/src/ReaderEither.ts b/src/ReaderEither.ts index decb8ff1e..fb1f0c983 100644 --- a/src/ReaderEither.ts +++ b/src/ReaderEither.ts @@ -221,6 +221,7 @@ export const local: (f: (r2: R2) => R1) => (ma: ReaderEither(f: (r1: R1) => ReaderEither) => ReaderEither = @@ -229,6 +230,7 @@ export const asksReaderEitherW: (f: (r1: R1) => ReaderEither(f: (r: R) => ReaderEither) => ReaderEither = @@ -340,7 +342,6 @@ export const ap: ( * * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged. * - * @category Apply * @since 2.8.0 */ export const apW: ( @@ -416,7 +417,6 @@ export const altW: ( ) => (fa: ReaderEither) => ReaderEither = alt as any /** - * @category MonadThrow * @since 2.7.0 */ export const throwError: MonadThrow3['throwError'] = left diff --git a/src/ReaderIO.ts b/src/ReaderIO.ts index beb5e8602..4d58feb63 100644 --- a/src/ReaderIO.ts +++ b/src/ReaderIO.ts @@ -68,6 +68,7 @@ export const local: (f: (r2: R2) => R1) => (ma: ReaderIO) => R * * The `W` suffix (short for **W**idening) means that the environment types will be merged. * + * @category constructors * @since 2.13.0 */ export const asksReaderIOW: (f: (r1: R1) => ReaderIO) => ReaderIO = R.asksReaderW @@ -75,6 +76,7 @@ export const asksReaderIOW: (f: (r1: R1) => ReaderIO) => Reade /** * Effectfully accesses the environment. * + * @category constructors * @since 2.13.0 */ export const asksReaderIO: (f: (r: R) => ReaderIO) => ReaderIO = asksReaderIOW @@ -103,7 +105,6 @@ export const ap: (fa: ReaderIO) => (fab: ReaderIO B> * * The `W` suffix (short for **W**idening) means that the environment types will be merged. * - * @category Apply * @since 2.13.0 */ export const apW: (fa: ReaderIO) => (fab: ReaderIO B>) => ReaderIO = diff --git a/src/ReaderTask.ts b/src/ReaderTask.ts index 36d262fc8..864c861c2 100644 --- a/src/ReaderTask.ts +++ b/src/ReaderTask.ts @@ -101,6 +101,7 @@ export const local: (f: (r2: R2) => R1) => (ma: ReaderTask) => * * The `W` suffix (short for **W**idening) means that the environment types will be merged. * + * @category constructors * @since 2.11.0 */ export const asksReaderTaskW: (f: (r1: R1) => ReaderTask) => ReaderTask = R.asksReaderW @@ -108,6 +109,7 @@ export const asksReaderTaskW: (f: (r1: R1) => ReaderTask) => R /** * Effectfully accesses the environment. * + * @category constructors * @since 2.11.0 */ export const asksReaderTask: (f: (r: R) => ReaderTask) => ReaderTask = asksReaderTaskW @@ -143,7 +145,6 @@ export const ap: (fa: ReaderTask) => (fab: ReaderTask( diff --git a/src/ReaderTaskEither.ts b/src/ReaderTaskEither.ts index 7c4639d83..e0cae4fd8 100644 --- a/src/ReaderTaskEither.ts +++ b/src/ReaderTaskEither.ts @@ -376,6 +376,7 @@ export const local: ( * * The `W` suffix (short for **W**idening) means that the environment types will be merged. * + * @category constructors * @since 2.11.0 */ export const asksReaderTaskEitherW: ( @@ -385,6 +386,7 @@ export const asksReaderTaskEitherW: ( /** * Effectfully accesses the environment. * + * @category constructors * @since 2.11.0 */ export const asksReaderTaskEither: (f: (r: R) => ReaderTaskEither) => ReaderTaskEither = @@ -627,7 +629,6 @@ export const ap: ( * * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged. * - * @category Apply * @since 2.8.0 */ export const apW: ( @@ -705,7 +706,6 @@ export const altW: ( ) => (fa: ReaderTaskEither) => ReaderTaskEither = alt as any /** - * @category MonadThrow * @since 2.0.0 */ export const throwError: MonadThrow3['throwError'] = left diff --git a/src/ReadonlyTuple.ts b/src/ReadonlyTuple.ts index ec9db2e4a..84a1ad88a 100644 --- a/src/ReadonlyTuple.ts +++ b/src/ReadonlyTuple.ts @@ -199,7 +199,6 @@ export const mapSnd: (f: (e: E) => G) => (fa: readonly [A, E]) => reado [fst(fa), f(snd(fa))] /** - * @category Semigroupoid * @since 2.5.0 */ export const compose: (ab: readonly [B, A]) => (bc: readonly [C, B]) => readonly [C, A] = (ab) => (bc) => diff --git a/src/StateReaderTaskEither.ts b/src/StateReaderTaskEither.ts index 0e1369827..191a4f7b6 100644 --- a/src/StateReaderTaskEither.ts +++ b/src/StateReaderTaskEither.ts @@ -244,6 +244,7 @@ export const local = /** * Less strict version of [`asksStateReaderTaskEither`](#asksstatereadertaskeither). * + * @category constructors * @since 2.11.0 */ export const asksStateReaderTaskEitherW = @@ -255,6 +256,7 @@ export const asksStateReaderTaskEitherW = /** * Effectfully accesses the environment. * + * @category constructors * @since 2.11.0 */ export const asksStateReaderTaskEither: ( @@ -430,7 +432,6 @@ export const ap: ( * * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged. * - * @category Apply * @since 2.8.0 */ export const apW: ( @@ -515,7 +516,6 @@ export const alt: ( ) => (fa: StateReaderTaskEither) => StateReaderTaskEither = altW /** - * @category MonadThrow * @since 2.7.0 */ export const throwError: MonadThrow4['throwError'] = left diff --git a/src/TaskEither.ts b/src/TaskEither.ts index 50ccd3d07..9ec5aa951 100644 --- a/src/TaskEither.ts +++ b/src/TaskEither.ts @@ -367,6 +367,7 @@ export const orElseFirstW: ( ) => (ma: TaskEither) => TaskEither = orElseFirst as any /** + * @category error handling * @since 2.12.0 */ export const orElseFirstIOK: (onLeft: (e: E) => IO) => (ma: TaskEither) => TaskEither = ( @@ -374,6 +375,7 @@ export const orElseFirstIOK: (onLeft: (e: E) => IO) => (ma: TaskEith ) => orElseFirst(fromIOK(onLeft)) /** + * @category error handling * @since 2.12.0 */ export const orElseFirstTaskK: (onLeft: (e: E) => Task) => (ma: TaskEither) => TaskEither = ( @@ -506,7 +508,6 @@ export const ap: (fa: TaskEither) => (fab: TaskEither( @@ -614,7 +615,6 @@ export const altW: (that: Lazy>) => (fa: TaskEit export const of: (a: A) => TaskEither = right /** - * @category MonadTask * @since 2.7.0 */ export const throwError: MonadThrow2['throwError'] = left @@ -1186,6 +1186,7 @@ export const chainFirstTaskK: (f: (a: A) => T.Task) => (first: TaskE * const stat = taskify(fs.stat) * assert.strictEqual(stat.length, 0) * + * @category interop * @since 2.0.0 */ export function taskify(f: (cb: (e: L | null | undefined, r?: R) => void) => void): () => TaskEither diff --git a/src/Tuple.ts b/src/Tuple.ts index 7c4a4bb78..9db0543c9 100644 --- a/src/Tuple.ts +++ b/src/Tuple.ts @@ -190,7 +190,6 @@ export const mapFst: (f: (a: A) => B) => (fa: [A, E]) => [B, E] = (f) = export const mapSnd: (f: (e: E) => G) => (fa: [A, E]) => [A, G] = (f) => (fa) => [fst(fa), f(snd(fa))] /** - * @category Semigroupoid * @since 2.0.0 */ export const compose: (ab: [B, A]) => (bc: [C, B]) => [C, A] = (ab) => (bc) => [fst(bc), snd(ab)]