1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-07-15 01:24:23 +02:00

fix: add missing ChainReaderIOK

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2023-10-06 23:02:45 +02:00
parent e313f95865
commit 254c63a16f
3 changed files with 53 additions and 0 deletions

View File

@ -480,6 +480,34 @@ func ChainIOK[
return RIE.ChainIOK[GRA, GRB](f)
}
func MonadChainReaderIOK[
GRB ~func(context.Context) GIOB,
GRA ~func(context.Context) GIOA,
GRIO ~func(context.Context) GIO,
GIOA ~func() E.Either[error, A],
GIOB ~func() E.Either[error, B],
GIO ~func() B,
A, B any](ma GRA, f func(A) GRIO) GRB {
return RIE.MonadChainReaderIOK[GRA, GRB](ma, f)
}
func ChainReaderIOK[
GRB ~func(context.Context) GIOB,
GRA ~func(context.Context) GIOA,
GRIO ~func(context.Context) GIO,
GIOA ~func() E.Either[error, A],
GIOB ~func() E.Either[error, B],
GIO ~func() B,
A, B any](f func(A) GRIO) func(ma GRA) GRB {
return RIE.ChainReaderIOK[GRA, GRB](f)
}
func MonadChainFirstIOK[
GRA ~func(context.Context) GIOA,
GIOA ~func() E.Either[error, A],

View File

@ -164,6 +164,14 @@ func Never[A any]() ReaderIOEither[A] {
return G.Never[ReaderIOEither[A]]()
}
func MonadChainReaderIOK[A, B any](ma ReaderIOEither[A], f func(A) RIO.ReaderIO[B]) ReaderIOEither[B] {
return G.MonadChainReaderIOK[ReaderIOEither[B], ReaderIOEither[A]](ma, f)
}
func ChainReaderIOK[A, B any](f func(A) RIO.ReaderIO[B]) func(ma ReaderIOEither[A]) ReaderIOEither[B] {
return G.ChainReaderIOK[ReaderIOEither[B], ReaderIOEither[A]](f)
}
func MonadChainIOK[A, B any](ma ReaderIOEither[A], f func(A) IO.IO[B]) ReaderIOEither[B] {
return G.MonadChainIOK[ReaderIOEither[B], ReaderIOEither[A]](ma, f)
}

View File

@ -147,6 +147,23 @@ func ChainReaderK[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() ET.Either[E
)
}
func MonadChainReaderIOK[GEA ~func(R) GIOEA, GEB ~func(R) GIOEB, GIOEA ~func() ET.Either[E, A], GIOEB ~func() ET.Either[E, B], GIOB ~func() B, GB ~func(R) GIOB, R, E, A, B any](ma GEA, f func(A) GB) GEB {
return FR.MonadChainReaderK(
MonadChain[GEA, GEB, GIOEA, GIOEB, R, E, A, B],
RightReaderIO[GEB, GIOEB, GB, GIOB, R, E, B],
ma,
f,
)
}
func ChainReaderIOK[GEA ~func(R) GIOEA, GEB ~func(R) GIOEB, GIOEA ~func() ET.Either[E, A], GIOEB ~func() ET.Either[E, B], GIOB ~func() B, GB ~func(R) GIOB, R, E, A, B any](f func(A) GB) func(GEA) GEB {
return FR.ChainReaderK(
MonadChain[GEA, GEB, GIOEA, GIOEB, R, E, A, B],
RightReaderIO[GEB, GIOEB, GB, GIOB, R, E, B],
f,
)
}
func MonadChainIOEitherK[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() ET.Either[E, A], GIOB ~func() ET.Either[E, B], R, E, A, B any](ma GEA, f func(A) GIOB) GEB {
return FIOE.MonadChainIOEitherK(
MonadChain[GEA, GEB, GIOA, GIOB, R, E, A, B],