mirror of
https://github.com/IBM/fp-go.git
synced 2025-08-10 22:31:32 +02:00
fix: add missing RightReaderIO and FromReaderIO to context
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
@@ -620,3 +620,47 @@ func Flatten[
|
|||||||
A any](rdr GGRA) GRA {
|
A any](rdr GGRA) GRA {
|
||||||
return RIE.Flatten[GRA](rdr)
|
return RIE.Flatten[GRA](rdr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func MonadFromReaderIO[
|
||||||
|
GRIOEA ~func(context.Context) GIOEA,
|
||||||
|
GIOEA ~func() E.Either[error, A],
|
||||||
|
|
||||||
|
GRIOA ~func(context.Context) GIOA,
|
||||||
|
GIOA ~func() A,
|
||||||
|
|
||||||
|
A any](a A, f func(A) GRIOA) GRIOEA {
|
||||||
|
return RIE.MonadFromReaderIO[GRIOEA](a, f)
|
||||||
|
}
|
||||||
|
|
||||||
|
func FromReaderIO[
|
||||||
|
GRIOEA ~func(context.Context) GIOEA,
|
||||||
|
GIOEA ~func() E.Either[error, A],
|
||||||
|
|
||||||
|
GRIOA ~func(context.Context) GIOA,
|
||||||
|
GIOA ~func() A,
|
||||||
|
|
||||||
|
A any](f func(A) GRIOA) func(A) GRIOEA {
|
||||||
|
return RIE.FromReaderIO[GRIOEA](f)
|
||||||
|
}
|
||||||
|
|
||||||
|
func RightReaderIO[
|
||||||
|
GRIOEA ~func(context.Context) GIOEA,
|
||||||
|
GIOEA ~func() E.Either[error, A],
|
||||||
|
|
||||||
|
GRIOA ~func(context.Context) GIOA,
|
||||||
|
GIOA ~func() A,
|
||||||
|
|
||||||
|
A any](ma GRIOA) GRIOEA {
|
||||||
|
return RIE.RightReaderIO[GRIOEA](ma)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LeftReaderIO[
|
||||||
|
GRIOEA ~func(context.Context) GIOEA,
|
||||||
|
GIOEA ~func() E.Either[error, A],
|
||||||
|
|
||||||
|
GRIOE ~func(context.Context) GIOE,
|
||||||
|
GIOE ~func() error,
|
||||||
|
|
||||||
|
A any](ma GRIOE) GRIOEA {
|
||||||
|
return RIE.LeftReaderIO[GRIOEA](ma)
|
||||||
|
}
|
||||||
|
@@ -234,3 +234,19 @@ func Flatten[
|
|||||||
A any](rdr ReaderIOEither[ReaderIOEither[A]]) ReaderIOEither[A] {
|
A any](rdr ReaderIOEither[ReaderIOEither[A]]) ReaderIOEither[A] {
|
||||||
return G.Flatten[ReaderIOEither[ReaderIOEither[A]]](rdr)
|
return G.Flatten[ReaderIOEither[ReaderIOEither[A]]](rdr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func MonadFromReaderIO[A any](a A, f func(A) RIO.ReaderIO[A]) ReaderIOEither[A] {
|
||||||
|
return G.MonadFromReaderIO[ReaderIOEither[A]](a, f)
|
||||||
|
}
|
||||||
|
|
||||||
|
func FromReaderIO[A any](f func(A) RIO.ReaderIO[A]) func(A) ReaderIOEither[A] {
|
||||||
|
return G.FromReaderIO[ReaderIOEither[A]](f)
|
||||||
|
}
|
||||||
|
|
||||||
|
func RightReaderIO[A any](ma RIO.ReaderIO[A]) ReaderIOEither[A] {
|
||||||
|
return G.RightReaderIO[ReaderIOEither[A]](ma)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LeftReaderIO[A any](ma RIO.ReaderIO[error]) ReaderIOEither[A] {
|
||||||
|
return G.LeftReaderIO[ReaderIOEither[A]](ma)
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user