1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-08-10 22:31:32 +02:00

fix: auto generate SequenceT for ReaderIOEither

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2023-07-20 16:17:23 +02:00
parent 680c103239
commit 9e32acf551
21 changed files with 5045 additions and 4657 deletions

View File

@@ -1,4 +1,19 @@
// Package readerioeither contains a version of [ReaderIOEither] that takes a golang [context.Context] as its context
// Copyright (c) 2023 IBM Corp.
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package readerioeither contains a version of [ReaderIOEither] that takes a golang [context.Context] as its context and that assumes the standard go error
package readerioeither
//go:generate go run ../.. contextreaderioeither --count 10 --filename gen.go

View File

@@ -2,76 +2,127 @@ package readerioeither
// Code generated by go generate; DO NOT EDIT.
// This file was generated by robots at
// 2023-07-19 16:18:34.1521763 +0200 CEST m=+0.011558001
// 2023-07-20 16:14:27.3155005 +0200 CEST m=+0.020795301
import (
"context"
G "github.com/IBM/fp-go/context/readerioeither/generic"
T "github.com/IBM/fp-go/tuple"
)
// Eitherize0 converts a function with 0 parameters returning a tuple into a function with 0 parameters returning a [ReaderIOEither[R]]
// The inverse function is [Uneitherize0]
func Eitherize0[F ~func(context.Context) (R, error), R any](f F) func() ReaderIOEither[R] {
return G.Eitherize0[ReaderIOEither[R]](f)
return G.Eitherize0[ReaderIOEither[R]](f)
}
// Eitherize1 converts a function with 1 parameters returning a tuple into a function with 1 parameters returning a [ReaderIOEither[R]]
// The inverse function is [Uneitherize1]
func Eitherize1[F ~func(context.Context, T0) (R, error), T0, R any](f F) func(T0) ReaderIOEither[R] {
return G.Eitherize1[ReaderIOEither[R]](f)
return G.Eitherize1[ReaderIOEither[R]](f)
}
// SequenceT1 converts 1 [ReaderIOEither] into a [ReaderIOEither] of a [T.Tuple1].
func SequenceT1[T1 any](t1 ReaderIOEither[T1]) ReaderIOEither[T.Tuple1[T1]] {
return G.SequenceT1[ReaderIOEither[T.Tuple1[T1]]](t1)
}
// Eitherize2 converts a function with 2 parameters returning a tuple into a function with 2 parameters returning a [ReaderIOEither[R]]
// The inverse function is [Uneitherize2]
func Eitherize2[F ~func(context.Context, T0, T1) (R, error), T0, T1, R any](f F) func(T0, T1) ReaderIOEither[R] {
return G.Eitherize2[ReaderIOEither[R]](f)
return G.Eitherize2[ReaderIOEither[R]](f)
}
// SequenceT2 converts 2 [ReaderIOEither] into a [ReaderIOEither] of a [T.Tuple2].
func SequenceT2[T1, T2 any](t1 ReaderIOEither[T1], t2 ReaderIOEither[T2]) ReaderIOEither[T.Tuple2[T1, T2]] {
return G.SequenceT2[ReaderIOEither[T.Tuple2[T1, T2]]](t1, t2)
}
// Eitherize3 converts a function with 3 parameters returning a tuple into a function with 3 parameters returning a [ReaderIOEither[R]]
// The inverse function is [Uneitherize3]
func Eitherize3[F ~func(context.Context, T0, T1, T2) (R, error), T0, T1, T2, R any](f F) func(T0, T1, T2) ReaderIOEither[R] {
return G.Eitherize3[ReaderIOEither[R]](f)
return G.Eitherize3[ReaderIOEither[R]](f)
}
// SequenceT3 converts 3 [ReaderIOEither] into a [ReaderIOEither] of a [T.Tuple3].
func SequenceT3[T1, T2, T3 any](t1 ReaderIOEither[T1], t2 ReaderIOEither[T2], t3 ReaderIOEither[T3]) ReaderIOEither[T.Tuple3[T1, T2, T3]] {
return G.SequenceT3[ReaderIOEither[T.Tuple3[T1, T2, T3]]](t1, t2, t3)
}
// Eitherize4 converts a function with 4 parameters returning a tuple into a function with 4 parameters returning a [ReaderIOEither[R]]
// The inverse function is [Uneitherize4]
func Eitherize4[F ~func(context.Context, T0, T1, T2, T3) (R, error), T0, T1, T2, T3, R any](f F) func(T0, T1, T2, T3) ReaderIOEither[R] {
return G.Eitherize4[ReaderIOEither[R]](f)
return G.Eitherize4[ReaderIOEither[R]](f)
}
// SequenceT4 converts 4 [ReaderIOEither] into a [ReaderIOEither] of a [T.Tuple4].
func SequenceT4[T1, T2, T3, T4 any](t1 ReaderIOEither[T1], t2 ReaderIOEither[T2], t3 ReaderIOEither[T3], t4 ReaderIOEither[T4]) ReaderIOEither[T.Tuple4[T1, T2, T3, T4]] {
return G.SequenceT4[ReaderIOEither[T.Tuple4[T1, T2, T3, T4]]](t1, t2, t3, t4)
}
// Eitherize5 converts a function with 5 parameters returning a tuple into a function with 5 parameters returning a [ReaderIOEither[R]]
// The inverse function is [Uneitherize5]
func Eitherize5[F ~func(context.Context, T0, T1, T2, T3, T4) (R, error), T0, T1, T2, T3, T4, R any](f F) func(T0, T1, T2, T3, T4) ReaderIOEither[R] {
return G.Eitherize5[ReaderIOEither[R]](f)
return G.Eitherize5[ReaderIOEither[R]](f)
}
// SequenceT5 converts 5 [ReaderIOEither] into a [ReaderIOEither] of a [T.Tuple5].
func SequenceT5[T1, T2, T3, T4, T5 any](t1 ReaderIOEither[T1], t2 ReaderIOEither[T2], t3 ReaderIOEither[T3], t4 ReaderIOEither[T4], t5 ReaderIOEither[T5]) ReaderIOEither[T.Tuple5[T1, T2, T3, T4, T5]] {
return G.SequenceT5[ReaderIOEither[T.Tuple5[T1, T2, T3, T4, T5]]](t1, t2, t3, t4, t5)
}
// Eitherize6 converts a function with 6 parameters returning a tuple into a function with 6 parameters returning a [ReaderIOEither[R]]
// The inverse function is [Uneitherize6]
func Eitherize6[F ~func(context.Context, T0, T1, T2, T3, T4, T5) (R, error), T0, T1, T2, T3, T4, T5, R any](f F) func(T0, T1, T2, T3, T4, T5) ReaderIOEither[R] {
return G.Eitherize6[ReaderIOEither[R]](f)
return G.Eitherize6[ReaderIOEither[R]](f)
}
// SequenceT6 converts 6 [ReaderIOEither] into a [ReaderIOEither] of a [T.Tuple6].
func SequenceT6[T1, T2, T3, T4, T5, T6 any](t1 ReaderIOEither[T1], t2 ReaderIOEither[T2], t3 ReaderIOEither[T3], t4 ReaderIOEither[T4], t5 ReaderIOEither[T5], t6 ReaderIOEither[T6]) ReaderIOEither[T.Tuple6[T1, T2, T3, T4, T5, T6]] {
return G.SequenceT6[ReaderIOEither[T.Tuple6[T1, T2, T3, T4, T5, T6]]](t1, t2, t3, t4, t5, t6)
}
// Eitherize7 converts a function with 7 parameters returning a tuple into a function with 7 parameters returning a [ReaderIOEither[R]]
// The inverse function is [Uneitherize7]
func Eitherize7[F ~func(context.Context, T0, T1, T2, T3, T4, T5, T6) (R, error), T0, T1, T2, T3, T4, T5, T6, R any](f F) func(T0, T1, T2, T3, T4, T5, T6) ReaderIOEither[R] {
return G.Eitherize7[ReaderIOEither[R]](f)
return G.Eitherize7[ReaderIOEither[R]](f)
}
// SequenceT7 converts 7 [ReaderIOEither] into a [ReaderIOEither] of a [T.Tuple7].
func SequenceT7[T1, T2, T3, T4, T5, T6, T7 any](t1 ReaderIOEither[T1], t2 ReaderIOEither[T2], t3 ReaderIOEither[T3], t4 ReaderIOEither[T4], t5 ReaderIOEither[T5], t6 ReaderIOEither[T6], t7 ReaderIOEither[T7]) ReaderIOEither[T.Tuple7[T1, T2, T3, T4, T5, T6, T7]] {
return G.SequenceT7[ReaderIOEither[T.Tuple7[T1, T2, T3, T4, T5, T6, T7]]](t1, t2, t3, t4, t5, t6, t7)
}
// Eitherize8 converts a function with 8 parameters returning a tuple into a function with 8 parameters returning a [ReaderIOEither[R]]
// The inverse function is [Uneitherize8]
func Eitherize8[F ~func(context.Context, T0, T1, T2, T3, T4, T5, T6, T7) (R, error), T0, T1, T2, T3, T4, T5, T6, T7, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7) ReaderIOEither[R] {
return G.Eitherize8[ReaderIOEither[R]](f)
return G.Eitherize8[ReaderIOEither[R]](f)
}
// SequenceT8 converts 8 [ReaderIOEither] into a [ReaderIOEither] of a [T.Tuple8].
func SequenceT8[T1, T2, T3, T4, T5, T6, T7, T8 any](t1 ReaderIOEither[T1], t2 ReaderIOEither[T2], t3 ReaderIOEither[T3], t4 ReaderIOEither[T4], t5 ReaderIOEither[T5], t6 ReaderIOEither[T6], t7 ReaderIOEither[T7], t8 ReaderIOEither[T8]) ReaderIOEither[T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]] {
return G.SequenceT8[ReaderIOEither[T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]]](t1, t2, t3, t4, t5, t6, t7, t8)
}
// Eitherize9 converts a function with 9 parameters returning a tuple into a function with 9 parameters returning a [ReaderIOEither[R]]
// The inverse function is [Uneitherize9]
func Eitherize9[F ~func(context.Context, T0, T1, T2, T3, T4, T5, T6, T7, T8) (R, error), T0, T1, T2, T3, T4, T5, T6, T7, T8, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7, T8) ReaderIOEither[R] {
return G.Eitherize9[ReaderIOEither[R]](f)
return G.Eitherize9[ReaderIOEither[R]](f)
}
// SequenceT9 converts 9 [ReaderIOEither] into a [ReaderIOEither] of a [T.Tuple9].
func SequenceT9[T1, T2, T3, T4, T5, T6, T7, T8, T9 any](t1 ReaderIOEither[T1], t2 ReaderIOEither[T2], t3 ReaderIOEither[T3], t4 ReaderIOEither[T4], t5 ReaderIOEither[T5], t6 ReaderIOEither[T6], t7 ReaderIOEither[T7], t8 ReaderIOEither[T8], t9 ReaderIOEither[T9]) ReaderIOEither[T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]] {
return G.SequenceT9[ReaderIOEither[T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]]](t1, t2, t3, t4, t5, t6, t7, t8, t9)
}
// Eitherize10 converts a function with 10 parameters returning a tuple into a function with 10 parameters returning a [ReaderIOEither[R]]
// The inverse function is [Uneitherize10]
func Eitherize10[F ~func(context.Context, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) (R, error), T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) ReaderIOEither[R] {
return G.Eitherize10[ReaderIOEither[R]](f)
return G.Eitherize10[ReaderIOEither[R]](f)
}
// SequenceT10 converts 10 [ReaderIOEither] into a [ReaderIOEither] of a [T.Tuple10].
func SequenceT10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 any](t1 ReaderIOEither[T1], t2 ReaderIOEither[T2], t3 ReaderIOEither[T3], t4 ReaderIOEither[T4], t5 ReaderIOEither[T5], t6 ReaderIOEither[T6], t7 ReaderIOEither[T7], t8 ReaderIOEither[T8], t9 ReaderIOEither[T9], t10 ReaderIOEither[T10]) ReaderIOEither[T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]] {
return G.SequenceT10[ReaderIOEither[T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]]](t1, t2, t3, t4, t5, t6, t7, t8, t9, t10)
}

View File

@@ -2,77 +2,499 @@ package generic
// Code generated by go generate; DO NOT EDIT.
// This file was generated by robots at
// 2023-07-19 16:18:34.1526819 +0200 CEST m=+0.012063601
// 2023-07-20 16:14:27.3155005 +0200 CEST m=+0.020795301
import (
"context"
E "github.com/IBM/fp-go/either"
RE "github.com/IBM/fp-go/readerioeither/generic"
A "github.com/IBM/fp-go/internal/apply"
T "github.com/IBM/fp-go/tuple"
)
// Eitherize0 converts a function with 0 parameters returning a tuple into a function with 0 parameters returning a [GRA]
// The inverse function is [Uneitherize0]
func Eitherize0[GRA ~func(context.Context) GIOA, F ~func(context.Context) (R, error), GIOA ~func() E.Either[error, R], R any](f F) func() GRA {
return RE.Eitherize0[GRA](f)
return RE.Eitherize0[GRA](f)
}
// Eitherize1 converts a function with 1 parameters returning a tuple into a function with 1 parameters returning a [GRA]
// The inverse function is [Uneitherize1]
func Eitherize1[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0) (R, error), GIOA ~func() E.Either[error, R], T0, R any](f F) func(T0) GRA {
return RE.Eitherize1[GRA](f)
return RE.Eitherize1[GRA](f)
}
// SequenceT1 converts 1 readers into a reader of a [T.Tuple1].
func SequenceT1[
GR_TUPLE1 ~func(context.Context) GIO_TUPLE1,
GR_T1 ~func(context.Context) GIO_T1,
GIO_TUPLE1 ~func() E.Either[error, T.Tuple1[T1]],
GIO_T1 ~func() E.Either[error, T1],
T1 any](
t1 GR_T1,
) GR_TUPLE1 {
return A.SequenceT1(
Map[GR_T1, GR_TUPLE1, GIO_T1],
t1,
)
}
// Eitherize2 converts a function with 2 parameters returning a tuple into a function with 2 parameters returning a [GRA]
// The inverse function is [Uneitherize2]
func Eitherize2[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1) (R, error), GIOA ~func() E.Either[error, R], T0, T1, R any](f F) func(T0, T1) GRA {
return RE.Eitherize2[GRA](f)
return RE.Eitherize2[GRA](f)
}
// SequenceT2 converts 2 readers into a reader of a [T.Tuple2].
func SequenceT2[
GR_TUPLE2 ~func(context.Context) GIO_TUPLE2,
GR_T1 ~func(context.Context) GIO_T1,
GR_T2 ~func(context.Context) GIO_T2,
GIO_TUPLE2 ~func() E.Either[error, T.Tuple2[T1, T2]],
GIO_T1 ~func() E.Either[error, T1],
GIO_T2 ~func() E.Either[error, T2],
T1,
T2 any](
t1 GR_T1,
t2 GR_T2,
) GR_TUPLE2 {
return A.SequenceT2(
Map[GR_T1, func(context.Context) func() E.Either[error, func(T2) T.Tuple2[T1, T2]], GIO_T1],
Ap[GR_TUPLE2, func(context.Context) func() E.Either[error, func(T2) T.Tuple2[T1, T2]], GR_T2],
t1,
t2,
)
}
// Eitherize3 converts a function with 3 parameters returning a tuple into a function with 3 parameters returning a [GRA]
// The inverse function is [Uneitherize3]
func Eitherize3[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1, T2) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, R any](f F) func(T0, T1, T2) GRA {
return RE.Eitherize3[GRA](f)
return RE.Eitherize3[GRA](f)
}
// SequenceT3 converts 3 readers into a reader of a [T.Tuple3].
func SequenceT3[
GR_TUPLE3 ~func(context.Context) GIO_TUPLE3,
GR_T1 ~func(context.Context) GIO_T1,
GR_T2 ~func(context.Context) GIO_T2,
GR_T3 ~func(context.Context) GIO_T3,
GIO_TUPLE3 ~func() E.Either[error, T.Tuple3[T1, T2, T3]],
GIO_T1 ~func() E.Either[error, T1],
GIO_T2 ~func() E.Either[error, T2],
GIO_T3 ~func() E.Either[error, T3],
T1,
T2,
T3 any](
t1 GR_T1,
t2 GR_T2,
t3 GR_T3,
) GR_TUPLE3 {
return A.SequenceT3(
Map[GR_T1, func(context.Context) func() E.Either[error, func(T2) func(T3) T.Tuple3[T1, T2, T3]], GIO_T1],
Ap[func(context.Context) func() E.Either[error, func(T3) T.Tuple3[T1, T2, T3]], func(context.Context) func() E.Either[error, func(T2) func(T3) T.Tuple3[T1, T2, T3]], GR_T2],
Ap[GR_TUPLE3, func(context.Context) func() E.Either[error, func(T3) T.Tuple3[T1, T2, T3]], GR_T3],
t1,
t2,
t3,
)
}
// Eitherize4 converts a function with 4 parameters returning a tuple into a function with 4 parameters returning a [GRA]
// The inverse function is [Uneitherize4]
func Eitherize4[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1, T2, T3) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, R any](f F) func(T0, T1, T2, T3) GRA {
return RE.Eitherize4[GRA](f)
return RE.Eitherize4[GRA](f)
}
// SequenceT4 converts 4 readers into a reader of a [T.Tuple4].
func SequenceT4[
GR_TUPLE4 ~func(context.Context) GIO_TUPLE4,
GR_T1 ~func(context.Context) GIO_T1,
GR_T2 ~func(context.Context) GIO_T2,
GR_T3 ~func(context.Context) GIO_T3,
GR_T4 ~func(context.Context) GIO_T4,
GIO_TUPLE4 ~func() E.Either[error, T.Tuple4[T1, T2, T3, T4]],
GIO_T1 ~func() E.Either[error, T1],
GIO_T2 ~func() E.Either[error, T2],
GIO_T3 ~func() E.Either[error, T3],
GIO_T4 ~func() E.Either[error, T4],
T1,
T2,
T3,
T4 any](
t1 GR_T1,
t2 GR_T2,
t3 GR_T3,
t4 GR_T4,
) GR_TUPLE4 {
return A.SequenceT4(
Map[GR_T1, func(context.Context) func() E.Either[error, func(T2) func(T3) func(T4) T.Tuple4[T1, T2, T3, T4]], GIO_T1],
Ap[func(context.Context) func() E.Either[error, func(T3) func(T4) T.Tuple4[T1, T2, T3, T4]], func(context.Context) func() E.Either[error, func(T2) func(T3) func(T4) T.Tuple4[T1, T2, T3, T4]], GR_T2],
Ap[func(context.Context) func() E.Either[error, func(T4) T.Tuple4[T1, T2, T3, T4]], func(context.Context) func() E.Either[error, func(T3) func(T4) T.Tuple4[T1, T2, T3, T4]], GR_T3],
Ap[GR_TUPLE4, func(context.Context) func() E.Either[error, func(T4) T.Tuple4[T1, T2, T3, T4]], GR_T4],
t1,
t2,
t3,
t4,
)
}
// Eitherize5 converts a function with 5 parameters returning a tuple into a function with 5 parameters returning a [GRA]
// The inverse function is [Uneitherize5]
func Eitherize5[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1, T2, T3, T4) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, R any](f F) func(T0, T1, T2, T3, T4) GRA {
return RE.Eitherize5[GRA](f)
return RE.Eitherize5[GRA](f)
}
// SequenceT5 converts 5 readers into a reader of a [T.Tuple5].
func SequenceT5[
GR_TUPLE5 ~func(context.Context) GIO_TUPLE5,
GR_T1 ~func(context.Context) GIO_T1,
GR_T2 ~func(context.Context) GIO_T2,
GR_T3 ~func(context.Context) GIO_T3,
GR_T4 ~func(context.Context) GIO_T4,
GR_T5 ~func(context.Context) GIO_T5,
GIO_TUPLE5 ~func() E.Either[error, T.Tuple5[T1, T2, T3, T4, T5]],
GIO_T1 ~func() E.Either[error, T1],
GIO_T2 ~func() E.Either[error, T2],
GIO_T3 ~func() E.Either[error, T3],
GIO_T4 ~func() E.Either[error, T4],
GIO_T5 ~func() E.Either[error, T5],
T1,
T2,
T3,
T4,
T5 any](
t1 GR_T1,
t2 GR_T2,
t3 GR_T3,
t4 GR_T4,
t5 GR_T5,
) GR_TUPLE5 {
return A.SequenceT5(
Map[GR_T1, func(context.Context) func() E.Either[error, func(T2) func(T3) func(T4) func(T5) T.Tuple5[T1, T2, T3, T4, T5]], GIO_T1],
Ap[func(context.Context) func() E.Either[error, func(T3) func(T4) func(T5) T.Tuple5[T1, T2, T3, T4, T5]], func(context.Context) func() E.Either[error, func(T2) func(T3) func(T4) func(T5) T.Tuple5[T1, T2, T3, T4, T5]], GR_T2],
Ap[func(context.Context) func() E.Either[error, func(T4) func(T5) T.Tuple5[T1, T2, T3, T4, T5]], func(context.Context) func() E.Either[error, func(T3) func(T4) func(T5) T.Tuple5[T1, T2, T3, T4, T5]], GR_T3],
Ap[func(context.Context) func() E.Either[error, func(T5) T.Tuple5[T1, T2, T3, T4, T5]], func(context.Context) func() E.Either[error, func(T4) func(T5) T.Tuple5[T1, T2, T3, T4, T5]], GR_T4],
Ap[GR_TUPLE5, func(context.Context) func() E.Either[error, func(T5) T.Tuple5[T1, T2, T3, T4, T5]], GR_T5],
t1,
t2,
t3,
t4,
t5,
)
}
// Eitherize6 converts a function with 6 parameters returning a tuple into a function with 6 parameters returning a [GRA]
// The inverse function is [Uneitherize6]
func Eitherize6[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1, T2, T3, T4, T5) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, R any](f F) func(T0, T1, T2, T3, T4, T5) GRA {
return RE.Eitherize6[GRA](f)
return RE.Eitherize6[GRA](f)
}
// SequenceT6 converts 6 readers into a reader of a [T.Tuple6].
func SequenceT6[
GR_TUPLE6 ~func(context.Context) GIO_TUPLE6,
GR_T1 ~func(context.Context) GIO_T1,
GR_T2 ~func(context.Context) GIO_T2,
GR_T3 ~func(context.Context) GIO_T3,
GR_T4 ~func(context.Context) GIO_T4,
GR_T5 ~func(context.Context) GIO_T5,
GR_T6 ~func(context.Context) GIO_T6,
GIO_TUPLE6 ~func() E.Either[error, T.Tuple6[T1, T2, T3, T4, T5, T6]],
GIO_T1 ~func() E.Either[error, T1],
GIO_T2 ~func() E.Either[error, T2],
GIO_T3 ~func() E.Either[error, T3],
GIO_T4 ~func() E.Either[error, T4],
GIO_T5 ~func() E.Either[error, T5],
GIO_T6 ~func() E.Either[error, T6],
T1,
T2,
T3,
T4,
T5,
T6 any](
t1 GR_T1,
t2 GR_T2,
t3 GR_T3,
t4 GR_T4,
t5 GR_T5,
t6 GR_T6,
) GR_TUPLE6 {
return A.SequenceT6(
Map[GR_T1, func(context.Context) func() E.Either[error, func(T2) func(T3) func(T4) func(T5) func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]], GIO_T1],
Ap[func(context.Context) func() E.Either[error, func(T3) func(T4) func(T5) func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]], func(context.Context) func() E.Either[error, func(T2) func(T3) func(T4) func(T5) func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]], GR_T2],
Ap[func(context.Context) func() E.Either[error, func(T4) func(T5) func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]], func(context.Context) func() E.Either[error, func(T3) func(T4) func(T5) func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]], GR_T3],
Ap[func(context.Context) func() E.Either[error, func(T5) func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]], func(context.Context) func() E.Either[error, func(T4) func(T5) func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]], GR_T4],
Ap[func(context.Context) func() E.Either[error, func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]], func(context.Context) func() E.Either[error, func(T5) func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]], GR_T5],
Ap[GR_TUPLE6, func(context.Context) func() E.Either[error, func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]], GR_T6],
t1,
t2,
t3,
t4,
t5,
t6,
)
}
// Eitherize7 converts a function with 7 parameters returning a tuple into a function with 7 parameters returning a [GRA]
// The inverse function is [Uneitherize7]
func Eitherize7[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1, T2, T3, T4, T5, T6) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, R any](f F) func(T0, T1, T2, T3, T4, T5, T6) GRA {
return RE.Eitherize7[GRA](f)
return RE.Eitherize7[GRA](f)
}
// SequenceT7 converts 7 readers into a reader of a [T.Tuple7].
func SequenceT7[
GR_TUPLE7 ~func(context.Context) GIO_TUPLE7,
GR_T1 ~func(context.Context) GIO_T1,
GR_T2 ~func(context.Context) GIO_T2,
GR_T3 ~func(context.Context) GIO_T3,
GR_T4 ~func(context.Context) GIO_T4,
GR_T5 ~func(context.Context) GIO_T5,
GR_T6 ~func(context.Context) GIO_T6,
GR_T7 ~func(context.Context) GIO_T7,
GIO_TUPLE7 ~func() E.Either[error, T.Tuple7[T1, T2, T3, T4, T5, T6, T7]],
GIO_T1 ~func() E.Either[error, T1],
GIO_T2 ~func() E.Either[error, T2],
GIO_T3 ~func() E.Either[error, T3],
GIO_T4 ~func() E.Either[error, T4],
GIO_T5 ~func() E.Either[error, T5],
GIO_T6 ~func() E.Either[error, T6],
GIO_T7 ~func() E.Either[error, T7],
T1,
T2,
T3,
T4,
T5,
T6,
T7 any](
t1 GR_T1,
t2 GR_T2,
t3 GR_T3,
t4 GR_T4,
t5 GR_T5,
t6 GR_T6,
t7 GR_T7,
) GR_TUPLE7 {
return A.SequenceT7(
Map[GR_T1, func(context.Context) func() E.Either[error, func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]], GIO_T1],
Ap[func(context.Context) func() E.Either[error, func(T3) func(T4) func(T5) func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]], func(context.Context) func() E.Either[error, func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]], GR_T2],
Ap[func(context.Context) func() E.Either[error, func(T4) func(T5) func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]], func(context.Context) func() E.Either[error, func(T3) func(T4) func(T5) func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]], GR_T3],
Ap[func(context.Context) func() E.Either[error, func(T5) func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]], func(context.Context) func() E.Either[error, func(T4) func(T5) func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]], GR_T4],
Ap[func(context.Context) func() E.Either[error, func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]], func(context.Context) func() E.Either[error, func(T5) func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]], GR_T5],
Ap[func(context.Context) func() E.Either[error, func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]], func(context.Context) func() E.Either[error, func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]], GR_T6],
Ap[GR_TUPLE7, func(context.Context) func() E.Either[error, func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]], GR_T7],
t1,
t2,
t3,
t4,
t5,
t6,
t7,
)
}
// Eitherize8 converts a function with 8 parameters returning a tuple into a function with 8 parameters returning a [GRA]
// The inverse function is [Uneitherize8]
func Eitherize8[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1, T2, T3, T4, T5, T6, T7) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, T7, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7) GRA {
return RE.Eitherize8[GRA](f)
return RE.Eitherize8[GRA](f)
}
// SequenceT8 converts 8 readers into a reader of a [T.Tuple8].
func SequenceT8[
GR_TUPLE8 ~func(context.Context) GIO_TUPLE8,
GR_T1 ~func(context.Context) GIO_T1,
GR_T2 ~func(context.Context) GIO_T2,
GR_T3 ~func(context.Context) GIO_T3,
GR_T4 ~func(context.Context) GIO_T4,
GR_T5 ~func(context.Context) GIO_T5,
GR_T6 ~func(context.Context) GIO_T6,
GR_T7 ~func(context.Context) GIO_T7,
GR_T8 ~func(context.Context) GIO_T8,
GIO_TUPLE8 ~func() E.Either[error, T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]],
GIO_T1 ~func() E.Either[error, T1],
GIO_T2 ~func() E.Either[error, T2],
GIO_T3 ~func() E.Either[error, T3],
GIO_T4 ~func() E.Either[error, T4],
GIO_T5 ~func() E.Either[error, T5],
GIO_T6 ~func() E.Either[error, T6],
GIO_T7 ~func() E.Either[error, T7],
GIO_T8 ~func() E.Either[error, T8],
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8 any](
t1 GR_T1,
t2 GR_T2,
t3 GR_T3,
t4 GR_T4,
t5 GR_T5,
t6 GR_T6,
t7 GR_T7,
t8 GR_T8,
) GR_TUPLE8 {
return A.SequenceT8(
Map[GR_T1, func(context.Context) func() E.Either[error, func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]], GIO_T1],
Ap[func(context.Context) func() E.Either[error, func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]], func(context.Context) func() E.Either[error, func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]], GR_T2],
Ap[func(context.Context) func() E.Either[error, func(T4) func(T5) func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]], func(context.Context) func() E.Either[error, func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]], GR_T3],
Ap[func(context.Context) func() E.Either[error, func(T5) func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]], func(context.Context) func() E.Either[error, func(T4) func(T5) func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]], GR_T4],
Ap[func(context.Context) func() E.Either[error, func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]], func(context.Context) func() E.Either[error, func(T5) func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]], GR_T5],
Ap[func(context.Context) func() E.Either[error, func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]], func(context.Context) func() E.Either[error, func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]], GR_T6],
Ap[func(context.Context) func() E.Either[error, func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]], func(context.Context) func() E.Either[error, func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]], GR_T7],
Ap[GR_TUPLE8, func(context.Context) func() E.Either[error, func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]], GR_T8],
t1,
t2,
t3,
t4,
t5,
t6,
t7,
t8,
)
}
// Eitherize9 converts a function with 9 parameters returning a tuple into a function with 9 parameters returning a [GRA]
// The inverse function is [Uneitherize9]
func Eitherize9[GRA ~func(context.Context) GIOA, F ~func(context.Context, 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, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7, T8) GRA {
return RE.Eitherize9[GRA](f)
return RE.Eitherize9[GRA](f)
}
// SequenceT9 converts 9 readers into a reader of a [T.Tuple9].
func SequenceT9[
GR_TUPLE9 ~func(context.Context) GIO_TUPLE9,
GR_T1 ~func(context.Context) GIO_T1,
GR_T2 ~func(context.Context) GIO_T2,
GR_T3 ~func(context.Context) GIO_T3,
GR_T4 ~func(context.Context) GIO_T4,
GR_T5 ~func(context.Context) GIO_T5,
GR_T6 ~func(context.Context) GIO_T6,
GR_T7 ~func(context.Context) GIO_T7,
GR_T8 ~func(context.Context) GIO_T8,
GR_T9 ~func(context.Context) GIO_T9,
GIO_TUPLE9 ~func() E.Either[error, T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]],
GIO_T1 ~func() E.Either[error, T1],
GIO_T2 ~func() E.Either[error, T2],
GIO_T3 ~func() E.Either[error, T3],
GIO_T4 ~func() E.Either[error, T4],
GIO_T5 ~func() E.Either[error, T5],
GIO_T6 ~func() E.Either[error, T6],
GIO_T7 ~func() E.Either[error, T7],
GIO_T8 ~func() E.Either[error, T8],
GIO_T9 ~func() E.Either[error, T9],
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
T9 any](
t1 GR_T1,
t2 GR_T2,
t3 GR_T3,
t4 GR_T4,
t5 GR_T5,
t6 GR_T6,
t7 GR_T7,
t8 GR_T8,
t9 GR_T9,
) GR_TUPLE9 {
return A.SequenceT9(
Map[GR_T1, func(context.Context) func() E.Either[error, func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], GIO_T1],
Ap[func(context.Context) func() E.Either[error, func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], func(context.Context) func() E.Either[error, func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], GR_T2],
Ap[func(context.Context) func() E.Either[error, func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], func(context.Context) func() E.Either[error, func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], GR_T3],
Ap[func(context.Context) func() E.Either[error, func(T5) func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], func(context.Context) func() E.Either[error, func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], GR_T4],
Ap[func(context.Context) func() E.Either[error, func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], func(context.Context) func() E.Either[error, func(T5) func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], GR_T5],
Ap[func(context.Context) func() E.Either[error, func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], func(context.Context) func() E.Either[error, func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], GR_T6],
Ap[func(context.Context) func() E.Either[error, func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], func(context.Context) func() E.Either[error, func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], GR_T7],
Ap[func(context.Context) func() E.Either[error, func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], func(context.Context) func() E.Either[error, func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], GR_T8],
Ap[GR_TUPLE9, func(context.Context) func() E.Either[error, func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]], GR_T9],
t1,
t2,
t3,
t4,
t5,
t6,
t7,
t8,
t9,
)
}
// Eitherize10 converts a function with 10 parameters returning a tuple into a function with 10 parameters returning a [GRA]
// The inverse function is [Uneitherize10]
func Eitherize10[GRA ~func(context.Context) GIOA, F ~func(context.Context, 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, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) GRA {
return RE.Eitherize10[GRA](f)
return RE.Eitherize10[GRA](f)
}
// SequenceT10 converts 10 readers into a reader of a [T.Tuple10].
func SequenceT10[
GR_TUPLE10 ~func(context.Context) GIO_TUPLE10,
GR_T1 ~func(context.Context) GIO_T1,
GR_T2 ~func(context.Context) GIO_T2,
GR_T3 ~func(context.Context) GIO_T3,
GR_T4 ~func(context.Context) GIO_T4,
GR_T5 ~func(context.Context) GIO_T5,
GR_T6 ~func(context.Context) GIO_T6,
GR_T7 ~func(context.Context) GIO_T7,
GR_T8 ~func(context.Context) GIO_T8,
GR_T9 ~func(context.Context) GIO_T9,
GR_T10 ~func(context.Context) GIO_T10,
GIO_TUPLE10 ~func() E.Either[error, T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]],
GIO_T1 ~func() E.Either[error, T1],
GIO_T2 ~func() E.Either[error, T2],
GIO_T3 ~func() E.Either[error, T3],
GIO_T4 ~func() E.Either[error, T4],
GIO_T5 ~func() E.Either[error, T5],
GIO_T6 ~func() E.Either[error, T6],
GIO_T7 ~func() E.Either[error, T7],
GIO_T8 ~func() E.Either[error, T8],
GIO_T9 ~func() E.Either[error, T9],
GIO_T10 ~func() E.Either[error, T10],
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
T9,
T10 any](
t1 GR_T1,
t2 GR_T2,
t3 GR_T3,
t4 GR_T4,
t5 GR_T5,
t6 GR_T6,
t7 GR_T7,
t8 GR_T8,
t9 GR_T9,
t10 GR_T10,
) GR_TUPLE10 {
return A.SequenceT10(
Map[GR_T1, func(context.Context) func() E.Either[error, func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], GIO_T1],
Ap[func(context.Context) func() E.Either[error, func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], func(context.Context) func() E.Either[error, func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], GR_T2],
Ap[func(context.Context) func() E.Either[error, func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], func(context.Context) func() E.Either[error, func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], GR_T3],
Ap[func(context.Context) func() E.Either[error, func(T5) func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], func(context.Context) func() E.Either[error, func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], GR_T4],
Ap[func(context.Context) func() E.Either[error, func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], func(context.Context) func() E.Either[error, func(T5) func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], GR_T5],
Ap[func(context.Context) func() E.Either[error, func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], func(context.Context) func() E.Either[error, func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], GR_T6],
Ap[func(context.Context) func() E.Either[error, func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], func(context.Context) func() E.Either[error, func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], GR_T7],
Ap[func(context.Context) func() E.Either[error, func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], func(context.Context) func() E.Either[error, func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], GR_T8],
Ap[func(context.Context) func() E.Either[error, func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], func(context.Context) func() E.Either[error, func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], GR_T9],
Ap[GR_TUPLE10, func(context.Context) func() E.Either[error, func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]], GR_T10],
t1,
t2,
t3,
t4,
t5,
t6,
t7,
t8,
t9,
t10,
)
}

View File

@@ -1,85 +0,0 @@
package generic
import (
"context"
E "github.com/IBM/fp-go/either"
RE "github.com/IBM/fp-go/readerioeither/generic"
T "github.com/IBM/fp-go/tuple"
)
// SequenceT converts n inputs of higher kinded types into a higher kinded types of n strongly typed values, represented as a tuple
func SequenceT1[
GRT ~func(context.Context) GIOT,
GRA ~func(context.Context) GIOA,
GIOA ~func() E.Either[error, A],
GIOT ~func() E.Either[error, T.Tuple1[A]],
A any](a GRA) GRT {
return RE.SequenceT1[
GRA,
GRT,
](a)
}
func SequenceT2[
GRT ~func(context.Context) GIOT,
GRA ~func(context.Context) GIOA,
GRB ~func(context.Context) GIOB,
GIOA ~func() E.Either[error, A],
GIOB ~func() E.Either[error, B],
GIOT ~func() E.Either[error, T.Tuple2[A, B]],
A, B any](a GRA, b GRB) GRT {
return RE.SequenceT2[
GRA,
GRB,
GRT,
](a, b)
}
func SequenceT3[
GRT ~func(context.Context) GIOT,
GRA ~func(context.Context) GIOA,
GRB ~func(context.Context) GIOB,
GRC ~func(context.Context) GIOC,
GIOA ~func() E.Either[error, A],
GIOB ~func() E.Either[error, B],
GIOC ~func() E.Either[error, C],
GIOT ~func() E.Either[error, T.Tuple3[A, B, C]],
A, B, C any](a GRA, b GRB, c GRC) GRT {
return RE.SequenceT3[
GRA,
GRB,
GRC,
GRT,
](a, b, c)
}
func SequenceT4[
GRT ~func(context.Context) GIOT,
GRA ~func(context.Context) GIOA,
GRB ~func(context.Context) GIOB,
GRC ~func(context.Context) GIOC,
GRD ~func(context.Context) GIOD,
GIOA ~func() E.Either[error, A],
GIOB ~func() E.Either[error, B],
GIOC ~func() E.Either[error, C],
GIOD ~func() E.Either[error, D],
GIOT ~func() E.Either[error, T.Tuple4[A, B, C, D]],
A, B, C, D any](a GRA, b GRB, c GRC, d GRD) GRT {
return RE.SequenceT4[
GRA,
GRB,
GRC,
GRD,
GRT,
](a, b, c, d)
}

View File

@@ -1,24 +0,0 @@
package readerioeither
import (
G "github.com/IBM/fp-go/context/readerioeither/generic"
T "github.com/IBM/fp-go/tuple"
)
// SequenceT converts n inputs of higher kinded types into a higher kinded types of n strongly typed values, represented as a tuple
func SequenceT1[A any](a ReaderIOEither[A]) ReaderIOEither[T.Tuple1[A]] {
return G.SequenceT1[ReaderIOEither[T.Tuple1[A]]](a)
}
func SequenceT2[A, B any](a ReaderIOEither[A], b ReaderIOEither[B]) ReaderIOEither[T.Tuple2[A, B]] {
return G.SequenceT2[ReaderIOEither[T.Tuple2[A, B]]](a, b)
}
func SequenceT3[A, B, C any](a ReaderIOEither[A], b ReaderIOEither[B], c ReaderIOEither[C]) ReaderIOEither[T.Tuple3[A, B, C]] {
return G.SequenceT3[ReaderIOEither[T.Tuple3[A, B, C]]](a, b, c)
}
func SequenceT4[A, B, C, D any](a ReaderIOEither[A], b ReaderIOEither[B], c ReaderIOEither[C], d ReaderIOEither[D]) ReaderIOEither[T.Tuple4[A, B, C, D]] {
return G.SequenceT4[ReaderIOEither[T.Tuple4[A, B, C, D]]](a, b, c, d)
}

View File

@@ -1,4 +1,18 @@
// Package readerioeither implements a specialization of the Reader monad assuming a golang context as the context of the monad and a standard golang error
// Copyright (c) 2023 IBM Corp.
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package readerioeither
import (