diff --git a/.changeset/red-timers-sing.md b/.changeset/red-timers-sing.md new file mode 100644 index 000000000..4e747f21a --- /dev/null +++ b/.changeset/red-timers-sing.md @@ -0,0 +1,5 @@ +--- +"@fp-ts/core": patch +--- + +NonEmptyProduct: rename bindKind to andThenBind diff --git a/Overview.md b/Overview.md index ada2319df..881046166 100644 --- a/Overview.md +++ b/Overview.md @@ -378,7 +378,7 @@ Extends: | productManyComposition | `F>`, `Iterable>>` | `F]>>` | | nonEmptyTuple | `[F, F, ...]` | `F<[A, B, ...]>` | | nonEmptyStruct | `{ a: F, b: F, ... }` | `F<{ a: A, b: B, ... }>` | -| bindKind | `F`, `name: string`, `F` | `F` | +| andThenBind | `F`, `name: string`, `F` | `F` | | productFlatten | `F`, `F` | `F<[...A, B]>` | ### NonEmptyTraversable diff --git a/src/typeclass/NonEmptyProduct.ts b/src/typeclass/NonEmptyProduct.ts index 9080914cd..757a6fa89 100644 --- a/src/typeclass/NonEmptyProduct.ts +++ b/src/typeclass/NonEmptyProduct.ts @@ -97,7 +97,7 @@ export const productMany = ( /** * @since 1.0.0 */ -export const bindKind = (F: NonEmptyProduct) => +export const andThenBind = (F: NonEmptyProduct) => ( name: Exclude, fb: Kind diff --git a/test/test-data/Option.ts b/test/test-data/Option.ts index 4b7144d22..0bd8bd595 100644 --- a/test/test-data/Option.ts +++ b/test/test-data/Option.ts @@ -1063,11 +1063,11 @@ export const bind: ( * @category do notation * @since 1.0.0 */ -export const bindOption: ( +export const andThenBind: ( name: Exclude, fb: Option ) => (self: Option) => Option<{ readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }> = - nonEmptyProduct.bindKind(NonEmptyApplicative) + nonEmptyProduct.andThenBind(NonEmptyApplicative) // ------------------------------------------------------------------------------------- // tuple sequencing diff --git a/test/test-data/Predicate.ts b/test/test-data/Predicate.ts index 913ea62fe..6ff801d8a 100644 --- a/test/test-data/Predicate.ts +++ b/test/test-data/Predicate.ts @@ -67,13 +67,13 @@ export const Product: product.Product = { } } -export const bindPredicate: ( +export const andThenBind: ( name: Exclude, fb: Predicate ) => ( self: Predicate ) => Predicate<{ readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }> = nonEmptyProduct - .bindKind( + .andThenBind( NonEmptyProduct ) diff --git a/test/typeclass/NonEmptyProduct.ts b/test/typeclass/NonEmptyProduct.ts index 2fa7c4142..2010dbf5e 100644 --- a/test/typeclass/NonEmptyProduct.ts +++ b/test/typeclass/NonEmptyProduct.ts @@ -138,18 +138,18 @@ describe("NonEmptyProduct", () => { }) }) - describe("bindKind", () => { + describe("andThenBind", () => { it("Covariant (Option)", () => { - const bindKind = _.bindKind(O.Applicative) - U.deepStrictEqual(pipe(O.some({ a: 1 }), bindKind("b", O.none)), O.none) - U.deepStrictEqual(pipe(O.some({ a: 1 }), bindKind("b", O.some(2))), O.some({ a: 1, b: 2 })) + const andThenBind = _.andThenBind(O.Applicative) + U.deepStrictEqual(pipe(O.some({ a: 1 }), andThenBind("b", O.none)), O.none) + U.deepStrictEqual(pipe(O.some({ a: 1 }), andThenBind("b", O.some(2))), O.some({ a: 1, b: 2 })) }) it("Contravariant (Predicate)", () => { const p = pipe( P.Do, - P.bindPredicate("x", P.isString), - P.bindPredicate("y", P.isNumber) + P.andThenBind("x", P.isString), + P.andThenBind("y", P.isNumber) ) U.deepStrictEqual(p({ x: "a", y: 1 }), true) U.deepStrictEqual(p({ x: "a", y: "x" }), false)