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 apFirstW and apSecondW #1564

Merged
merged 7 commits into from Nov 22, 2021
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
26 changes: 26 additions & 0 deletions docs/modules/Either.ts.md
Expand Up @@ -26,7 +26,9 @@ Added in v2.0.0

- [combinators](#combinators)
- [apFirst](#apfirst)
- [apFirstW](#apfirstw)
- [apSecond](#apsecond)
- [apSecondW](#apsecondw)
- [chainFirst](#chainfirst)
- [chainFirstW](#chainfirstw)
- [chainOptionK](#chainoptionk)
Expand Down Expand Up @@ -156,6 +158,18 @@ export declare const apFirst: <E, B>(second: Either<E, B>) => <A>(first: Either<

Added in v2.0.0

## apFirstW

Less strict version of [`apFirst`](#apfirst)

**Signature**

```ts
export declare const apFirstW: <E2, A, B>(second: Either<E2, B>) => <E1>(first: Either<E1, A>) => Either<E2 | E1, A>
```

Added in v2.12.0

## apSecond

Combine two effectful actions, keeping only the result of the second.
Expand All @@ -170,6 +184,18 @@ export declare const apSecond: <E, B>(second: Either<E, B>) => <A>(first: Either

Added in v2.0.0

## apSecondW

Less strict version of [`apSecond`](#apsecond)

**Signature**

```ts
export declare const apSecondW: <E2, A, B>(second: Either<E2, B>) => <E1>(first: Either<E1, A>) => Either<E2 | E1, B>
```

Added in v2.12.0

## chainFirst

Composes computations in sequence, using the return value of one computation to determine the next computation and
Expand Down
30 changes: 30 additions & 0 deletions docs/modules/IOEither.ts.md
Expand Up @@ -35,7 +35,9 @@ Added in v2.0.0
- [of](#of)
- [combinators](#combinators)
- [apFirst](#apfirst)
- [apFirstW](#apfirstw)
- [apSecond](#apsecond)
- [apSecondW](#apsecondw)
- [chainEitherK](#chaineitherk)
- [chainEitherKW](#chaineitherkw)
- [chainFirst](#chainfirst)
Expand Down Expand Up @@ -294,6 +296,20 @@ export declare const apFirst: <E, B>(second: IOEither<E, B>) => <A>(first: IOEit

Added in v2.0.0

## apFirstW

Less strict version of [`apFirst`](#apfirst).

**Signature**

```ts
export declare const apFirstW: <E2, A, B>(
second: IOEither<E2, B>
) => <E1>(first: IOEither<E1, A>) => IOEither<E2 | E1, A>
```

Added in v2.12.0

## apSecond

Combine two effectful actions, keeping only the result of the second.
Expand All @@ -308,6 +324,20 @@ export declare const apSecond: <E, B>(second: IOEither<E, B>) => <A>(first: IOEi

Added in v2.0.0

## apSecondW

Less strict version of [`apSecond`](#apsecond).

**Signature**

```ts
export declare const apSecondW: <E2, A, B>(
second: IOEither<E2, B>
) => <E1>(first: IOEither<E1, A>) => IOEither<E2 | E1, B>
```

Added in v2.12.0

## chainEitherK

**Signature**
Expand Down
26 changes: 26 additions & 0 deletions docs/modules/Reader.ts.md
Expand Up @@ -36,7 +36,9 @@ Added in v2.0.0
- [second](#second)
- [combinators](#combinators)
- [apFirst](#apfirst)
- [apFirstW](#apfirstw)
- [apSecond](#apsecond)
- [apSecondW](#apsecondw)
- [asksReader](#asksreader)
- [asksReaderW](#asksreaderw)
- [chainFirst](#chainfirst)
Expand Down Expand Up @@ -257,6 +259,18 @@ export declare const apFirst: <E, B>(second: Reader<E, B>) => <A>(first: Reader<

Added in v2.0.0

## apFirstW

Less strict version of [`apFirst`](#apfirst).

**Signature**

```ts
export declare const apFirstW: <R2, A, B>(second: Reader<R2, B>) => <R1>(first: Reader<R1, A>) => Reader<R1 & R2, A>
```

Added in v2.12.0

## apSecond

Combine two effectful actions, keeping only the result of the second.
Expand All @@ -271,6 +285,18 @@ export declare const apSecond: <E, B>(second: Reader<E, B>) => <A>(first: Reader

Added in v2.0.0

## apSecondW

Less strict version of [`apSecond`](#apsecond).

**Signature**

```ts
export declare const apSecondW: <R2, A, B>(second: Reader<R2, B>) => <R1>(first: Reader<R1, A>) => Reader<R1 & R2, B>
```

Added in v2.12.0

## asksReader

Effectfully accesses the environment.
Expand Down
30 changes: 30 additions & 0 deletions docs/modules/ReaderEither.ts.md
Expand Up @@ -32,7 +32,9 @@ Added in v2.0.0
- [of](#of)
- [combinators](#combinators)
- [apFirst](#apfirst)
- [apFirstW](#apfirstw)
- [apSecond](#apsecond)
- [apSecondW](#apsecondw)
- [asksReaderEither](#asksreadereither)
- [asksReaderEitherW](#asksreadereitherw)
- [chainEitherK](#chaineitherk)
Expand Down Expand Up @@ -300,6 +302,20 @@ export declare const apFirst: <R, E, B>(

Added in v2.0.0

## apFirstW

Less strict version of [`apFirst`](#apfirst)

**Signature**

```ts
export declare const apFirstW: <R2, E2, A, B>(
second: ReaderEither<R2, E2, B>
) => <R1, E1>(first: ReaderEither<R1, E1, A>) => ReaderEither<R1 & R2, E2 | E1, A>
```

Added in v2.12.0

## apSecond

Combine two effectful actions, keeping only the result of the second.
Expand All @@ -316,6 +332,20 @@ export declare const apSecond: <R, E, B>(

Added in v2.0.0

## apSecondW

Less strict version of [`apSecond`](#apsecond)

**Signature**

```ts
export declare const apSecondW: <R2, E2, A, B>(
second: ReaderEither<R2, E2, B>
) => <R1, E1>(first: ReaderEither<R1, E1, A>) => ReaderEither<R1 & R2, E2 | E1, B>
```

Added in v2.12.0

## asksReaderEither

Effectfully accesses the environment.
Expand Down
30 changes: 30 additions & 0 deletions docs/modules/ReaderTaskEither.ts.md
Expand Up @@ -32,7 +32,9 @@ Added in v2.0.0
- [of](#of)
- [combinators](#combinators)
- [apFirst](#apfirst)
- [apFirstW](#apfirstw)
- [apSecond](#apsecond)
- [apSecondW](#apsecondw)
- [asksReaderTaskEither](#asksreadertaskeither)
- [asksReaderTaskEitherW](#asksreadertaskeitherw)
- [chainEitherK](#chaineitherk)
Expand Down Expand Up @@ -351,6 +353,20 @@ export declare const apFirst: <R, E, B>(

Added in v2.0.0

## apFirstW

Less strict version of [`apFirst`](#apfirst).

**Signature**

```ts
export declare const apFirstW: <R2, E2, A, B>(
second: ReaderTaskEither<R2, E2, B>
) => <R1, E1>(first: ReaderTaskEither<R1, E1, A>) => ReaderTaskEither<R1 & R2, E2 | E1, A>
```

Added in v2.12.0

## apSecond

Combine two effectful actions, keeping only the result of the second.
Expand All @@ -367,6 +383,20 @@ export declare const apSecond: <R, E, B>(

Added in v2.0.0

## apSecondW

Less strict version of [`apSecond`](#apsecond).

**Signature**

```ts
export declare const apSecondW: <R2, E2, A, B>(
second: ReaderTaskEither<R2, E2, B>
) => <R1, E1>(first: ReaderTaskEither<R1, E1, A>) => ReaderTaskEither<R1 & R2, E2 | E1, B>
```

Added in v2.12.0

## asksReaderTaskEither

Effectfully accesses the environment.
Expand Down
30 changes: 30 additions & 0 deletions docs/modules/StateReaderTaskEither.ts.md
Expand Up @@ -32,7 +32,9 @@ Added in v2.0.0
- [of](#of)
- [combinators](#combinators)
- [apFirst](#apfirst)
- [apFirstW](#apfirstw)
- [apSecond](#apsecond)
- [apSecondW](#apsecondw)
- [asksStateReaderTaskEither](#asksstatereadertaskeither)
- [asksStateReaderTaskEitherW](#asksstatereadertaskeitherw)
- [chainEitherK](#chaineitherk)
Expand Down Expand Up @@ -322,6 +324,20 @@ export declare const apFirst: <S, R, E, B>(

Added in v2.0.0

## apFirstW

Less strict version of [`apFirst`](#apfirst).

**Signature**

```ts
export declare const apFirstW: <S, R2, E2, A, B>(
second: StateReaderTaskEither<S, R2, E2, B>
) => <R1, E1>(first: StateReaderTaskEither<S, R1, E1, A>) => StateReaderTaskEither<S, R1 & R2, E2 | E1, A>
```

Added in v2.12.0

## apSecond

Combine two effectful actions, keeping only the result of the second.
Expand All @@ -338,6 +354,20 @@ export declare const apSecond: <S, R, E, B>(

Added in v2.0.0

## apSecondW

Less strict version of [`apSecond`](#apsecond).

**Signature**

```ts
export declare const apSecondW: <S, R2, E2, A, B>(
second: StateReaderTaskEither<S, R2, E2, B>
) => <R1, E1>(first: StateReaderTaskEither<S, R1, E1, A>) => StateReaderTaskEither<S, R1 & R2, E2 | E1, B>
```

Added in v2.12.0

## asksStateReaderTaskEither

Effectfully accesses the environment.
Expand Down
30 changes: 30 additions & 0 deletions docs/modules/TaskEither.ts.md
Expand Up @@ -39,7 +39,9 @@ Added in v2.0.0
- [of](#of)
- [combinators](#combinators)
- [apFirst](#apfirst)
- [apFirstW](#apfirstw)
- [apSecond](#apsecond)
- [apSecondW](#apsecondw)
- [chainEitherK](#chaineitherk)
- [chainEitherKW](#chaineitherkw)
- [chainFirst](#chainfirst)
Expand Down Expand Up @@ -355,6 +357,20 @@ export declare const apFirst: <E, B>(second: TaskEither<E, B>) => <A>(first: Tas

Added in v2.0.0

## apFirstW

Less strict version of [`apFirst`](#apfirst).

**Signature**

```ts
export declare const apFirstW: <E2, A, B>(
second: TaskEither<E2, B>
) => <E1>(first: TaskEither<E1, A>) => TaskEither<E2 | E1, A>
```

Added in v2.12.0

## apSecond

Combine two effectful actions, keeping only the result of the second.
Expand All @@ -369,6 +385,20 @@ export declare const apSecond: <E, B>(second: TaskEither<E, B>) => <A>(first: Ta

Added in v2.0.0

## apSecondW

Less strict version of [`apSecond`](#apsecond).

**Signature**

```ts
export declare const apSecondW: <E2, A, B>(
second: TaskEither<E2, B>
) => <E1>(first: TaskEither<E1, A>) => TaskEither<E2 | E1, B>
```

Added in v2.12.0

## chainEitherK

**Signature**
Expand Down
20 changes: 20 additions & 0 deletions src/Either.ts
Expand Up @@ -926,6 +926,16 @@ export const apFirst =
/*#__PURE__*/
apFirst_(Apply)

/**
* Less strict version of [`apFirst`](#apfirst)
*
* @category combinators
* @since 2.12.0
*/
export const apFirstW: <E2, A, B>(
second: Either<E2, B>
) => <E1>(first: Either<E1, A>) => Either<E1 | E2, A> = apFirst as any

/**
* Combine two effectful actions, keeping only the result of the second.
*
Expand All @@ -938,6 +948,16 @@ export const apSecond =
/*#__PURE__*/
apSecond_(Apply)

/**
* Less strict version of [`apSecond`](#apsecond)
*
* @category combinators
* @since 2.12.0
*/
export const apSecondW: <E2, A, B>(
second: Either<E2, B>
) => <E1>(first: Either<E1, A>) => Either<E1 | E2, B> = apSecond as any

/**
* Composes computations in sequence, using the return value of one computation to determine the next computation and
* keeping only the result of the first.
Expand Down