Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add chainOptionKW #1846

Merged
merged 2 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/modules/Either.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ Added in v2.0.0
- [chainFirstW](#chainfirstw)
- [chainNullableK](#chainnullablek)
- [chainOptionK](#chainoptionk)
- [chainOptionKW](#chainoptionkw)
- [chainW](#chainw)
- [flatten](#flatten)
- [flattenW](#flattenw)
Expand Down Expand Up @@ -1389,6 +1390,22 @@ export declare const chainOptionK: <E>(

Added in v2.11.0

## chainOptionKW

Less strict version of [`chainOptionK`](#chainoptionk).

The `W` suffix (short for **W**idening) means that the error types will be merged.

**Signature**

```ts
export declare const chainOptionKW: <E2>(
onNone: Lazy<E2>
) => <A, B>(f: (a: A) => Option<B>) => <E1>(ma: Either<E1, A>) => Either<E2 | E1, B>
```

Added in v2.13.2

## chainW

Less strict version of [`chain`](#chain).
Expand Down
17 changes: 17 additions & 0 deletions docs/modules/IOEither.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Added in v2.0.0
- [chainFirstW](#chainfirstw)
- [chainIOK](#chainiok)
- [chainOptionK](#chainoptionk)
- [chainOptionKW](#chainoptionkw)
- [chainW](#chainw)
- [flatten](#flatten)
- [flattenW](#flattenw)
Expand Down Expand Up @@ -1037,6 +1038,22 @@ export declare const chainOptionK: <E>(

Added in v2.10.0

## chainOptionKW

Less strict version of [`chainOptionK`](#chainoptionk).

The `W` suffix (short for **W**idening) means that the error types will be merged.

**Signature**

```ts
export declare const chainOptionKW: <E2>(
onNone: Lazy<E2>
) => <A, B>(f: (a: A) => Option<B>) => <E1>(ma: IOEither<E1, A>) => IOEither<E2 | E1, B>
```

Added in v2.13.2

## chainW

Less strict version of [`chain`](#chain).
Expand Down
17 changes: 17 additions & 0 deletions docs/modules/ReaderEither.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Added in v2.0.0
- [chainFirstReaderKW](#chainfirstreaderkw)
- [chainFirstW](#chainfirstw)
- [chainOptionK](#chainoptionk)
- [chainOptionKW](#chainoptionkw)
- [chainReaderK](#chainreaderk)
- [chainReaderKW](#chainreaderkw)
- [chainW](#chainw)
Expand Down Expand Up @@ -1061,6 +1062,22 @@ export declare const chainOptionK: <E>(

Added in v2.10.0

## chainOptionKW

Less strict version of [`chainOptionK`](#chainoptionk).

The `W` suffix (short for **W**idening) means that the error types will be merged.

**Signature**

```ts
export declare const chainOptionKW: <E2>(
onNone: Lazy<E2>
) => <A, B>(f: (a: A) => Option<B>) => <R, E1>(ma: ReaderEither<R, E1, A>) => ReaderEither<R, E2 | E1, B>
```

Added in v2.13.2

## chainReaderK

**Signature**
Expand Down
17 changes: 17 additions & 0 deletions docs/modules/ReaderTaskEither.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ Added in v2.0.0
- [chainIOK](#chainiok)
- [chainNullableK](#chainnullablek)
- [chainOptionK](#chainoptionk)
- [chainOptionKW](#chainoptionkw)
- [chainReaderEitherK](#chainreadereitherk)
- [chainReaderEitherKW](#chainreadereitherkw)
- [chainReaderIOK](#chainreaderiok)
Expand Down Expand Up @@ -1643,6 +1644,22 @@ export declare const chainOptionK: <E>(

Added in v2.10.0

## chainOptionKW

Less strict version of [`chainOptionK`](#chainoptionk).

The `W` suffix (short for **W**idening) means that the error types will be merged.

**Signature**

```ts
export declare const chainOptionKW: <E2>(
onNone: Lazy<E2>
) => <A, B>(f: (a: A) => Option<B>) => <R, E1>(ma: ReaderTaskEither<R, E1, A>) => ReaderTaskEither<R, E2 | E1, B>
```

Added in v2.13.2

## chainReaderEitherK

**Signature**
Expand Down
19 changes: 19 additions & 0 deletions docs/modules/StateReaderTaskEither.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Added in v2.0.0
- [chainIOEitherKW](#chainioeitherkw)
- [chainIOK](#chainiok)
- [chainOptionK](#chainoptionk)
- [chainOptionKW](#chainoptionkw)
- [chainReaderK](#chainreaderk)
- [chainReaderKW](#chainreaderkw)
- [chainReaderTaskEitherK](#chainreadertaskeitherk)
Expand Down Expand Up @@ -1138,6 +1139,24 @@ export declare const chainOptionK: <E>(

Added in v2.10.0

## chainOptionKW

Less strict version of [`chainOptionK`](#chainoptionk).

The `W` suffix (short for **W**idening) means that the error types will be merged.

**Signature**

```ts
export declare const chainOptionKW: <E2>(
onNone: Lazy<E2>
) => <A, B>(
f: (a: A) => Option<B>
) => <S, R, E1>(ma: StateReaderTaskEither<S, R, E1, A>) => StateReaderTaskEither<S, R, E2 | E1, B>
```

Added in v2.13.2

## chainReaderK

**Signature**
Expand Down
17 changes: 17 additions & 0 deletions docs/modules/TaskEither.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Added in v2.0.0
- [chainIOK](#chainiok)
- [chainNullableK](#chainnullablek)
- [chainOptionK](#chainoptionk)
- [chainOptionKW](#chainoptionkw)
- [chainTaskK](#chaintaskk)
- [chainTaskOptionK](#chaintaskoptionk)
- [chainTaskOptionKW](#chaintaskoptionkw)
Expand Down Expand Up @@ -1442,6 +1443,22 @@ export declare const chainOptionK: <E>(

Added in v2.10.0

## chainOptionKW

Less strict version of [`chainOptionK`](#chainoptionk).

The `W` suffix (short for **W**idening) means that the error types will be merged.

**Signature**

```ts
export declare const chainOptionKW: <E2>(
onNone: Lazy<E2>
) => <A, B>(f: (a: A) => Option<B>) => <E1>(ma: TaskEither<E1, A>) => TaskEither<E2 | E1, B>
```

Added in v2.13.2

## chainTaskK

**Signature**
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fp-ts",
"version": "2.13.1",
"version": "2.13.2",
"description": "Functional programming in TypeScript",
"main": "./lib/index.js",
"module": "./es6/index.js",
Expand Down
12 changes: 12 additions & 0 deletions src/Either.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,18 @@ export const chainOptionK: <E>(
Chain
)

/**
* Less strict version of [`chainOptionK`](#chainoptionk).
*
* The `W` suffix (short for **W**idening) means that the error types will be merged.
*
* @category sequencing
* @since 2.13.2
*/
export const chainOptionKW: <E2>(
onNone: Lazy<E2>
) => <A, B>(f: (a: A) => Option<B>) => <E1>(ma: Either<E1, A>) => Either<E1 | E2, B> = /*#__PURE__*/ chainOptionK as any

/**
* @example
* import * as E from 'fp-ts/Either'
Expand Down
13 changes: 13 additions & 0 deletions src/IOEither.ts
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,19 @@ export const chainOptionK: <E>(
Chain
)

/**
* Less strict version of [`chainOptionK`](#chainoptionk).
*
* The `W` suffix (short for **W**idening) means that the error types will be merged.
*
* @category sequencing
* @since 2.13.2
*/
export const chainOptionKW: <E2>(
onNone: Lazy<E2>
) => <A, B>(f: (a: A) => Option<B>) => <E1>(ma: IOEither<E1, A>) => IOEither<E1 | E2, B> =
/*#__PURE__*/ chainOptionK as any

/**
* @category sequencing
* @since 2.4.0
Expand Down
13 changes: 13 additions & 0 deletions src/ReaderEither.ts
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,19 @@ export const chainOptionK: <E>(
) => <A, B>(f: (a: A) => Option<B>) => <R>(ma: ReaderEither<R, E, A>) => ReaderEither<R, E, B> =
/*#__PURE__*/ chainOptionK_(FromEither, Chain)

/**
* Less strict version of [`chainOptionK`](#chainoptionk).
*
* The `W` suffix (short for **W**idening) means that the error types will be merged.
*
* @category sequencing
* @since 2.13.2
*/
export const chainOptionKW: <E2>(
onNone: Lazy<E2>
) => <A, B>(f: (a: A) => Option<B>) => <R, E1>(ma: ReaderEither<R, E1, A>) => ReaderEither<R, E1 | E2, B> =
/*#__PURE__*/ chainOptionK as any

/**
* @category sequencing
* @since 2.4.0
Expand Down
13 changes: 13 additions & 0 deletions src/ReaderTaskEither.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,19 @@ export const chainOptionK: <E>(
) => <A, B>(f: (a: A) => Option<B>) => <R>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B> =
/*#__PURE__*/ chainOptionK_(FromEither, Chain)

/**
* Less strict version of [`chainOptionK`](#chainoptionk).
*
* The `W` suffix (short for **W**idening) means that the error types will be merged.
*
* @category sequencing
* @since 2.13.2
*/
export const chainOptionKW: <E2>(
onNone: Lazy<E2>
) => <A, B>(f: (a: A) => Option<B>) => <R, E1>(ma: ReaderTaskEither<R, E1, A>) => ReaderTaskEither<R, E1 | E2, B> =
/*#__PURE__*/ chainOptionK as any

/**
* @category sequencing
* @since 2.4.0
Expand Down
15 changes: 15 additions & 0 deletions src/StateReaderTaskEither.ts
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,21 @@ export const chainOptionK: <E>(
Chain
)

/**
* Less strict version of [`chainOptionK`](#chainoptionk).
*
* The `W` suffix (short for **W**idening) means that the error types will be merged.
*
* @category sequencing
* @since 2.13.2
*/
export const chainOptionKW: <E2>(
onNone: Lazy<E2>
) => <A, B>(
f: (a: A) => Option<B>
) => <S, R, E1>(ma: StateReaderTaskEither<S, R, E1, A>) => StateReaderTaskEither<S, R, E1 | E2, B> =
/*#__PURE__*/ chainOptionK as any

/**
* @category sequencing
* @since 2.4.0
Expand Down
13 changes: 13 additions & 0 deletions src/TaskEither.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,19 @@ export const chainOptionK: <E>(
Chain
)

/**
* Less strict version of [`chainOptionK`](#chainoptionk).
*
* The `W` suffix (short for **W**idening) means that the error types will be merged.
*
* @category sequencing
* @since 2.13.2
*/
export const chainOptionKW: <E2>(
onNone: Lazy<E2>
) => <A, B>(f: (a: A) => Option<B>) => <E1>(ma: TaskEither<E1, A>) => TaskEither<E1 | E2, B> =
/*#__PURE__*/ chainOptionK as any

/**
* @category sequencing
* @since 2.4.0
Expand Down