1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-11-29 22:38:29 +02:00

fix: order of parameters on Ap

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2023-07-14 13:20:00 +02:00
parent e42d399509
commit e350f70659
31 changed files with 373 additions and 231 deletions

View File

@@ -9,15 +9,15 @@ import (
func SequenceT1[E, A any](a Either[E, A]) Either[E, T.Tuple1[A]] {
return Apply.SequenceT1(
MonadMap[E, A, T.Tuple1[A]],
Map[E, A, T.Tuple1[A]],
a,
)
}
func SequenceT2[E, A, B any](a Either[E, A], b Either[E, B]) Either[E, T.Tuple2[A, B]] {
return Apply.SequenceT2(
MonadMap[E, A, func(B) T.Tuple2[A, B]],
MonadAp[E, B, T.Tuple2[A, B]],
Map[E, A, func(B) T.Tuple2[A, B]],
Ap[T.Tuple2[A, B], E, B],
a, b,
)
@@ -25,9 +25,9 @@ func SequenceT2[E, A, B any](a Either[E, A], b Either[E, B]) Either[E, T.Tuple2[
func SequenceT3[E, A, B, C any](a Either[E, A], b Either[E, B], c Either[E, C]) Either[E, T.Tuple3[A, B, C]] {
return Apply.SequenceT3(
MonadMap[E, A, func(B) func(C) T.Tuple3[A, B, C]],
MonadAp[E, B, func(C) T.Tuple3[A, B, C]],
MonadAp[E, C, T.Tuple3[A, B, C]],
Map[E, A, func(B) func(C) T.Tuple3[A, B, C]],
Ap[func(C) T.Tuple3[A, B, C], E, B],
Ap[T.Tuple3[A, B, C], E, C],
a, b, c,
)
@@ -35,10 +35,10 @@ func SequenceT3[E, A, B, C any](a Either[E, A], b Either[E, B], c Either[E, C])
func SequenceT4[E, A, B, C, D any](a Either[E, A], b Either[E, B], c Either[E, C], d Either[E, D]) Either[E, T.Tuple4[A, B, C, D]] {
return Apply.SequenceT4(
MonadMap[E, A, func(B) func(C) func(D) T.Tuple4[A, B, C, D]],
MonadAp[E, B, func(C) func(D) T.Tuple4[A, B, C, D]],
MonadAp[E, C, func(D) T.Tuple4[A, B, C, D]],
MonadAp[E, D, T.Tuple4[A, B, C, D]],
Map[E, A, func(B) func(C) func(D) T.Tuple4[A, B, C, D]],
Ap[func(C) func(D) T.Tuple4[A, B, C, D], E, B],
Ap[func(D) T.Tuple4[A, B, C, D], E, C],
Ap[T.Tuple4[A, B, C, D], E, D],
a, b, c, d,
)