diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f56bf59..b152167 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -82,7 +82,7 @@ jobs: - name: Semantic Release run: | - npx -p conventional-changelog-conventionalcommits -p semantic-release semantic-release --dry-run ${{env.DRY_RUN}} + npx -p "conventional-changelog-conventionalcommits@<8" -p semantic-release semantic-release --dry-run ${{env.DRY_RUN}} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/cli/readerioeither.go b/cli/readerioeither.go index 8c35d01..170e750 100644 --- a/cli/readerioeither.go +++ b/cli/readerioeither.go @@ -136,6 +136,70 @@ func generateReaderIOEitherEitherize(f, fg *os.File, i int) { fmt.Fprintf(fg, "}\n") } +func generateReaderIOEitherUneitherize(f, fg *os.File, i int) { + // non generic version + fmt.Fprintf(f, "\n// Uneitherize%d converts a function with %d parameters returning a [ReaderIOEither[C, error, R]] into a function with %d parameters returning a tuple.\n// The first parameter is considered to be the context [C].\n", i, i+1, i) + fmt.Fprintf(f, "func Uneitherize%d[F ~func(", i) + for j := 0; j < i; j++ { + if j > 0 { + fmt.Fprintf(f, ", ") + } + fmt.Fprintf(f, "T%d", j) + } + fmt.Fprintf(f, ") ReaderIOEither[C, error, R]") + for j := 0; j < i; j++ { + fmt.Fprintf(f, ", T%d", j) + } + fmt.Fprintf(f, ", C, R any](f F) func(C") + for j := 0; j < i; j++ { + fmt.Fprintf(f, ", T%d", j) + } + fmt.Fprintf(f, ") (R, error) {\n") + fmt.Fprintf(f, " return G.Uneitherize%d[ReaderIOEither[C, error, R]", i) + + fmt.Fprintf(f, ", func(C") + for j := 0; j < i; j++ { + fmt.Fprintf(f, ", T%d", j) + } + fmt.Fprintf(f, ")(R, error)](f)\n") + fmt.Fprintln(f, "}") + + // generic version + fmt.Fprintf(fg, "\n// Uneitherize%d converts a function with %d parameters returning a [GRA] into a function with %d parameters returning a tuple.\n// The first parameter is considered to be the context [C].\n", i, i, i) + fmt.Fprintf(fg, "func Uneitherize%d[GRA ~func(C) GIOA, F ~func(C", i) + for j := 0; j < i; j++ { + fmt.Fprintf(fg, ", T%d", j) + } + fmt.Fprintf(fg, ") (R, error), GIOA ~func() E.Either[error, R]") + for j := 0; j < i; j++ { + fmt.Fprintf(fg, ", T%d", j) + } + fmt.Fprintf(fg, ", C, R any](f func(") + for j := 0; j < i; j++ { + if j > 0 { + fmt.Fprintf(fg, ", ") + } + fmt.Fprintf(fg, "T%d", j) + } + fmt.Fprintf(fg, ") GRA) F {\n") + + fmt.Fprintf(fg, " return func(c C") + for j := 0; j < i; j++ { + fmt.Fprintf(fg, ", t%d T%d", j, j) + } + fmt.Fprintf(fg, ") (R, error) {\n") + fmt.Fprintf(fg, " return E.UnwrapError(f(") + for j := 0; j < i; j++ { + if j > 0 { + fmt.Fprintf(fg, ", ") + } + fmt.Fprintf(fg, "t%d", j) + } + fmt.Fprintf(fg, ")(c)())\n") + fmt.Fprintf(fg, " }\n") + fmt.Fprintf(fg, "}\n") +} + func generateReaderIOEitherHelpers(filename string, count int) error { dir, err := os.Getwd() if err != nil { @@ -197,12 +261,16 @@ import ( generateReaderIOEitherFrom(f, fg, 0) // eitherize generateReaderIOEitherEitherize(f, fg, 0) + // uneitherize + generateReaderIOEitherUneitherize(f, fg, 0) for i := 1; i <= count; i++ { // from generateReaderIOEitherFrom(f, fg, i) // eitherize generateReaderIOEitherEitherize(f, fg, i) + // uneitherize + generateReaderIOEitherUneitherize(f, fg, i) } return nil diff --git a/readerioeither/gen.go b/readerioeither/gen.go index 6f2294f..2d5f7e5 100644 --- a/readerioeither/gen.go +++ b/readerioeither/gen.go @@ -1,6 +1,6 @@ // Code generated by go generate; DO NOT EDIT. // This file was generated by robots at -// 2024-02-29 16:19:28.6907128 +0100 CET m=+0.032796101 +// 2024-05-24 17:26:07.2835624 +0200 CEST m=+0.011499301 package readerioeither @@ -20,6 +20,12 @@ func Eitherize0[F ~func(C) (R, error), C, R any](f F) func() ReaderIOEither[C, e return G.Eitherize0[ReaderIOEither[C, error, R]](f) } +// Uneitherize0 converts a function with 1 parameters returning a [ReaderIOEither[C, error, R]] into a function with 0 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize0[F ~func() ReaderIOEither[C, error, R], C, R any](f F) func(C) (R, error) { + return G.Uneitherize0[ReaderIOEither[C, error, R], func(C) (R, error)](f) +} + // From1 converts a function with 2 parameters returning a tuple into a function with 1 parameters returning a [ReaderIOEither[R]] // The first parameter is considered to be the context [C]. func From1[F ~func(C, T0) func() (R, error), T0, C, R any](f F) func(T0) ReaderIOEither[C, error, R] { @@ -32,6 +38,12 @@ func Eitherize1[F ~func(C, T0) (R, error), T0, C, R any](f F) func(T0) ReaderIOE return G.Eitherize1[ReaderIOEither[C, error, R]](f) } +// Uneitherize1 converts a function with 2 parameters returning a [ReaderIOEither[C, error, R]] into a function with 1 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize1[F ~func(T0) ReaderIOEither[C, error, R], T0, C, R any](f F) func(C, T0) (R, error) { + return G.Uneitherize1[ReaderIOEither[C, error, R], func(C, T0) (R, error)](f) +} + // From2 converts a function with 3 parameters returning a tuple into a function with 2 parameters returning a [ReaderIOEither[R]] // The first parameter is considered to be the context [C]. func From2[F ~func(C, T0, T1) func() (R, error), T0, T1, C, R any](f F) func(T0, T1) ReaderIOEither[C, error, R] { @@ -44,6 +56,12 @@ func Eitherize2[F ~func(C, T0, T1) (R, error), T0, T1, C, R any](f F) func(T0, T return G.Eitherize2[ReaderIOEither[C, error, R]](f) } +// Uneitherize2 converts a function with 3 parameters returning a [ReaderIOEither[C, error, R]] into a function with 2 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize2[F ~func(T0, T1) ReaderIOEither[C, error, R], T0, T1, C, R any](f F) func(C, T0, T1) (R, error) { + return G.Uneitherize2[ReaderIOEither[C, error, R], func(C, T0, T1) (R, error)](f) +} + // From3 converts a function with 4 parameters returning a tuple into a function with 3 parameters returning a [ReaderIOEither[R]] // The first parameter is considered to be the context [C]. func From3[F ~func(C, T0, T1, T2) func() (R, error), T0, T1, T2, C, R any](f F) func(T0, T1, T2) ReaderIOEither[C, error, R] { @@ -56,6 +74,12 @@ func Eitherize3[F ~func(C, T0, T1, T2) (R, error), T0, T1, T2, C, R any](f F) fu return G.Eitherize3[ReaderIOEither[C, error, R]](f) } +// Uneitherize3 converts a function with 4 parameters returning a [ReaderIOEither[C, error, R]] into a function with 3 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize3[F ~func(T0, T1, T2) ReaderIOEither[C, error, R], T0, T1, T2, C, R any](f F) func(C, T0, T1, T2) (R, error) { + return G.Uneitherize3[ReaderIOEither[C, error, R], func(C, T0, T1, T2) (R, error)](f) +} + // From4 converts a function with 5 parameters returning a tuple into a function with 4 parameters returning a [ReaderIOEither[R]] // The first parameter is considered to be the context [C]. func From4[F ~func(C, T0, T1, T2, T3) func() (R, error), T0, T1, T2, T3, C, R any](f F) func(T0, T1, T2, T3) ReaderIOEither[C, error, R] { @@ -68,6 +92,12 @@ func Eitherize4[F ~func(C, T0, T1, T2, T3) (R, error), T0, T1, T2, T3, C, R any] return G.Eitherize4[ReaderIOEither[C, error, R]](f) } +// Uneitherize4 converts a function with 5 parameters returning a [ReaderIOEither[C, error, R]] into a function with 4 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize4[F ~func(T0, T1, T2, T3) ReaderIOEither[C, error, R], T0, T1, T2, T3, C, R any](f F) func(C, T0, T1, T2, T3) (R, error) { + return G.Uneitherize4[ReaderIOEither[C, error, R], func(C, T0, T1, T2, T3) (R, error)](f) +} + // From5 converts a function with 6 parameters returning a tuple into a function with 5 parameters returning a [ReaderIOEither[R]] // The first parameter is considered to be the context [C]. func From5[F ~func(C, T0, T1, T2, T3, T4) func() (R, error), T0, T1, T2, T3, T4, C, R any](f F) func(T0, T1, T2, T3, T4) ReaderIOEither[C, error, R] { @@ -80,6 +110,12 @@ func Eitherize5[F ~func(C, T0, T1, T2, T3, T4) (R, error), T0, T1, T2, T3, T4, C return G.Eitherize5[ReaderIOEither[C, error, R]](f) } +// Uneitherize5 converts a function with 6 parameters returning a [ReaderIOEither[C, error, R]] into a function with 5 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize5[F ~func(T0, T1, T2, T3, T4) ReaderIOEither[C, error, R], T0, T1, T2, T3, T4, C, R any](f F) func(C, T0, T1, T2, T3, T4) (R, error) { + return G.Uneitherize5[ReaderIOEither[C, error, R], func(C, T0, T1, T2, T3, T4) (R, error)](f) +} + // From6 converts a function with 7 parameters returning a tuple into a function with 6 parameters returning a [ReaderIOEither[R]] // The first parameter is considered to be the context [C]. func From6[F ~func(C, T0, T1, T2, T3, T4, T5) func() (R, error), T0, T1, T2, T3, T4, T5, C, R any](f F) func(T0, T1, T2, T3, T4, T5) ReaderIOEither[C, error, R] { @@ -92,6 +128,12 @@ func Eitherize6[F ~func(C, T0, T1, T2, T3, T4, T5) (R, error), T0, T1, T2, T3, T return G.Eitherize6[ReaderIOEither[C, error, R]](f) } +// Uneitherize6 converts a function with 7 parameters returning a [ReaderIOEither[C, error, R]] into a function with 6 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize6[F ~func(T0, T1, T2, T3, T4, T5) ReaderIOEither[C, error, R], T0, T1, T2, T3, T4, T5, C, R any](f F) func(C, T0, T1, T2, T3, T4, T5) (R, error) { + return G.Uneitherize6[ReaderIOEither[C, error, R], func(C, T0, T1, T2, T3, T4, T5) (R, error)](f) +} + // From7 converts a function with 8 parameters returning a tuple into a function with 7 parameters returning a [ReaderIOEither[R]] // The first parameter is considered to be the context [C]. func From7[F ~func(C, T0, T1, T2, T3, T4, T5, T6) func() (R, error), T0, T1, T2, T3, T4, T5, T6, C, R any](f F) func(T0, T1, T2, T3, T4, T5, T6) ReaderIOEither[C, error, R] { @@ -104,6 +146,12 @@ func Eitherize7[F ~func(C, T0, T1, T2, T3, T4, T5, T6) (R, error), T0, T1, T2, T return G.Eitherize7[ReaderIOEither[C, error, R]](f) } +// Uneitherize7 converts a function with 8 parameters returning a [ReaderIOEither[C, error, R]] into a function with 7 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize7[F ~func(T0, T1, T2, T3, T4, T5, T6) ReaderIOEither[C, error, R], T0, T1, T2, T3, T4, T5, T6, C, R any](f F) func(C, T0, T1, T2, T3, T4, T5, T6) (R, error) { + return G.Uneitherize7[ReaderIOEither[C, error, R], func(C, T0, T1, T2, T3, T4, T5, T6) (R, error)](f) +} + // From8 converts a function with 9 parameters returning a tuple into a function with 8 parameters returning a [ReaderIOEither[R]] // The first parameter is considered to be the context [C]. func From8[F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7) func() (R, error), T0, T1, T2, T3, T4, T5, T6, T7, C, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7) ReaderIOEither[C, error, R] { @@ -116,6 +164,12 @@ func Eitherize8[F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7) (R, error), T0, T1, T return G.Eitherize8[ReaderIOEither[C, error, R]](f) } +// Uneitherize8 converts a function with 9 parameters returning a [ReaderIOEither[C, error, R]] into a function with 8 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize8[F ~func(T0, T1, T2, T3, T4, T5, T6, T7) ReaderIOEither[C, error, R], T0, T1, T2, T3, T4, T5, T6, T7, C, R any](f F) func(C, T0, T1, T2, T3, T4, T5, T6, T7) (R, error) { + return G.Uneitherize8[ReaderIOEither[C, error, R], func(C, T0, T1, T2, T3, T4, T5, T6, T7) (R, error)](f) +} + // From9 converts a function with 10 parameters returning a tuple into a function with 9 parameters returning a [ReaderIOEither[R]] // The first parameter is considered to be the context [C]. func From9[F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8) func() (R, error), T0, T1, T2, T3, T4, T5, T6, T7, T8, C, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7, T8) ReaderIOEither[C, error, R] { @@ -128,6 +182,12 @@ func Eitherize9[F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8) (R, error), T0, T return G.Eitherize9[ReaderIOEither[C, error, R]](f) } +// Uneitherize9 converts a function with 10 parameters returning a [ReaderIOEither[C, error, R]] into a function with 9 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize9[F ~func(T0, T1, T2, T3, T4, T5, T6, T7, T8) ReaderIOEither[C, error, R], T0, T1, T2, T3, T4, T5, T6, T7, T8, C, R any](f F) func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8) (R, error) { + return G.Uneitherize9[ReaderIOEither[C, error, R], func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8) (R, error)](f) +} + // From10 converts a function with 11 parameters returning a tuple into a function with 10 parameters returning a [ReaderIOEither[R]] // The first parameter is considered to be the context [C]. func From10[F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) func() (R, error), T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, C, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) ReaderIOEither[C, error, R] { @@ -139,3 +199,9 @@ func From10[F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) func() (R, error) func Eitherize10[F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) (R, error), T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, C, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) ReaderIOEither[C, error, R] { return G.Eitherize10[ReaderIOEither[C, error, R]](f) } + +// Uneitherize10 converts a function with 11 parameters returning a [ReaderIOEither[C, error, R]] into a function with 10 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize10[F ~func(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) ReaderIOEither[C, error, R], T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, C, R any](f F) func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) (R, error) { + return G.Uneitherize10[ReaderIOEither[C, error, R], func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) (R, error)](f) +} diff --git a/readerioeither/generic/gen.go b/readerioeither/generic/gen.go index 345816a..f629525 100644 --- a/readerioeither/generic/gen.go +++ b/readerioeither/generic/gen.go @@ -1,6 +1,6 @@ // Code generated by go generate; DO NOT EDIT. // This file was generated by robots at -// 2024-02-29 16:19:28.691247 +0100 CET m=+0.033330301 +// 2024-05-24 17:26:07.2835624 +0200 CEST m=+0.011499301 package generic import ( @@ -26,6 +26,14 @@ func Eitherize0[GRA ~func(C) GIOA, F ~func(C) (R, error), GIOA ~func() E.Either[ }) } +// Uneitherize0 converts a function with 0 parameters returning a [GRA] into a function with 0 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize0[GRA ~func(C) GIOA, F ~func(C) (R, error), GIOA ~func() E.Either[error, R], C, R any](f func() GRA) F { + return func(c C) (R, error) { + return E.UnwrapError(f()(c)()) + } +} + // From1 converts a function with 2 parameters returning a tuple into a function with 1 parameters returning a [GRA] // The first parameter is considerd to be the context [C]. func From1[GRA ~func(C) GIOA, F ~func(C, T0) func() (R, error), GIOA ~func() E.Either[error, R], T0, C, R any](f F) func(T0) GRA { @@ -44,6 +52,14 @@ func Eitherize1[GRA ~func(C) GIOA, F ~func(C, T0) (R, error), GIOA ~func() E.Eit }) } +// Uneitherize1 converts a function with 1 parameters returning a [GRA] into a function with 1 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize1[GRA ~func(C) GIOA, F ~func(C, T0) (R, error), GIOA ~func() E.Either[error, R], T0, C, R any](f func(T0) GRA) F { + return func(c C, t0 T0) (R, error) { + return E.UnwrapError(f(t0)(c)()) + } +} + // From2 converts a function with 3 parameters returning a tuple into a function with 2 parameters returning a [GRA] // The first parameter is considerd to be the context [C]. func From2[GRA ~func(C) GIOA, F ~func(C, T0, T1) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, C, R any](f F) func(T0, T1) GRA { @@ -62,6 +78,14 @@ func Eitherize2[GRA ~func(C) GIOA, F ~func(C, T0, T1) (R, error), GIOA ~func() E }) } +// Uneitherize2 converts a function with 2 parameters returning a [GRA] into a function with 2 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize2[GRA ~func(C) GIOA, F ~func(C, T0, T1) (R, error), GIOA ~func() E.Either[error, R], T0, T1, C, R any](f func(T0, T1) GRA) F { + return func(c C, t0 T0, t1 T1) (R, error) { + return E.UnwrapError(f(t0, t1)(c)()) + } +} + // From3 converts a function with 4 parameters returning a tuple into a function with 3 parameters returning a [GRA] // The first parameter is considerd to be the context [C]. func From3[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, C, R any](f F) func(T0, T1, T2) GRA { @@ -80,6 +104,14 @@ func Eitherize3[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2) (R, error), GIOA ~func }) } +// Uneitherize3 converts a function with 3 parameters returning a [GRA] into a function with 3 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize3[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, C, R any](f func(T0, T1, T2) GRA) F { + return func(c C, t0 T0, t1 T1, t2 T2) (R, error) { + return E.UnwrapError(f(t0, t1, t2)(c)()) + } +} + // From4 converts a function with 5 parameters returning a tuple into a function with 4 parameters returning a [GRA] // The first parameter is considerd to be the context [C]. func From4[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, C, R any](f F) func(T0, T1, T2, T3) GRA { @@ -98,6 +130,14 @@ func Eitherize4[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3) (R, error), GIOA ~ }) } +// Uneitherize4 converts a function with 4 parameters returning a [GRA] into a function with 4 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize4[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, C, R any](f func(T0, T1, T2, T3) GRA) F { + return func(c C, t0 T0, t1 T1, t2 T2, t3 T3) (R, error) { + return E.UnwrapError(f(t0, t1, t2, t3)(c)()) + } +} + // From5 converts a function with 6 parameters returning a tuple into a function with 5 parameters returning a [GRA] // The first parameter is considerd to be the context [C]. func From5[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, C, R any](f F) func(T0, T1, T2, T3, T4) GRA { @@ -116,6 +156,14 @@ func Eitherize5[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4) (R, error), GI }) } +// Uneitherize5 converts a function with 5 parameters returning a [GRA] into a function with 5 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize5[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, C, R any](f func(T0, T1, T2, T3, T4) GRA) F { + return func(c C, t0 T0, t1 T1, t2 T2, t3 T3, t4 T4) (R, error) { + return E.UnwrapError(f(t0, t1, t2, t3, t4)(c)()) + } +} + // From6 converts a function with 7 parameters returning a tuple into a function with 6 parameters returning a [GRA] // The first parameter is considerd to be the context [C]. func From6[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, C, R any](f F) func(T0, T1, T2, T3, T4, T5) GRA { @@ -134,6 +182,14 @@ func Eitherize6[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5) (R, error) }) } +// Uneitherize6 converts a function with 6 parameters returning a [GRA] into a function with 6 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize6[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, C, R any](f func(T0, T1, T2, T3, T4, T5) GRA) F { + return func(c C, t0 T0, t1 T1, t2 T2, t3 T3, t4 T4, t5 T5) (R, error) { + return E.UnwrapError(f(t0, t1, t2, t3, t4, t5)(c)()) + } +} + // From7 converts a function with 8 parameters returning a tuple into a function with 7 parameters returning a [GRA] // The first parameter is considerd to be the context [C]. func From7[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, C, R any](f F) func(T0, T1, T2, T3, T4, T5, T6) GRA { @@ -152,6 +208,14 @@ func Eitherize7[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6) (R, er }) } +// Uneitherize7 converts a function with 7 parameters returning a [GRA] into a function with 7 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize7[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, C, R any](f func(T0, T1, T2, T3, T4, T5, T6) GRA) F { + return func(c C, t0 T0, t1 T1, t2 T2, t3 T3, t4 T4, t5 T5, t6 T6) (R, error) { + return E.UnwrapError(f(t0, t1, t2, t3, t4, t5, t6)(c)()) + } +} + // From8 converts a function with 9 parameters returning a tuple into a function with 8 parameters returning a [GRA] // The first parameter is considerd to be the context [C]. func From8[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, T7, C, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7) GRA { @@ -170,6 +234,14 @@ func Eitherize8[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7) (R }) } +// Uneitherize8 converts a function with 8 parameters returning a [GRA] into a function with 8 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize8[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, T7, C, R any](f func(T0, T1, T2, T3, T4, T5, T6, T7) GRA) F { + return func(c C, t0 T0, t1 T1, t2 T2, t3 T3, t4 T4, t5 T5, t6 T6, t7 T7) (R, error) { + return E.UnwrapError(f(t0, t1, t2, t3, t4, t5, t6, t7)(c)()) + } +} + // From9 converts a function with 10 parameters returning a tuple into a function with 9 parameters returning a [GRA] // The first parameter is considerd to be the context [C]. func From9[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, T7, T8, C, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7, T8) GRA { @@ -188,6 +260,14 @@ func Eitherize9[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8 }) } +// Uneitherize9 converts a function with 9 parameters returning a [GRA] into a function with 9 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize9[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, T7, T8, C, R any](f func(T0, T1, T2, T3, T4, T5, T6, T7, T8) GRA) F { + return func(c C, t0 T0, t1 T1, t2 T2, t3 T3, t4 T4, t5 T5, t6 T6, t7 T7, t8 T8) (R, error) { + return E.UnwrapError(f(t0, t1, t2, t3, t4, t5, t6, t7, t8)(c)()) + } +} + // From10 converts a function with 11 parameters returning a tuple into a function with 10 parameters returning a [GRA] // The first parameter is considerd to be the context [C]. func From10[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, C, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) GRA { @@ -205,3 +285,11 @@ func Eitherize10[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7, T } }) } + +// Uneitherize10 converts a function with 10 parameters returning a [GRA] into a function with 10 parameters returning a tuple. +// The first parameter is considered to be the context [C]. +func Uneitherize10[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, C, R any](f func(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) GRA) F { + return func(c C, t0 T0, t1 T1, t2 T2, t3 T3, t4 T4, t5 T5, t6 T6, t7 T7, t8 T8, t9 T9) (R, error) { + return E.UnwrapError(f(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9)(c)()) + } +} diff --git a/renovate.json b/renovate.json index 7ead388..d8bf774 100644 --- a/renovate.json +++ b/renovate.json @@ -25,6 +25,15 @@ ], "automerge": true, "groupName": "go dependencies" + }, + { + "matchPackageNames": [ + "conventional-changelog-conventionalcommits" + ], + "matchUpdateTypes": [ + "major" + ], + "enabled": false } ] } \ No newline at end of file