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

fix: remove Reader and ReaderEither for context since they do not make sense

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2023-10-23 09:05:10 +02:00
parent 08d9fed9af
commit da3c9683eb
19 changed files with 20 additions and 805 deletions

View File

@@ -19,15 +19,14 @@ import (
"context"
E "github.com/IBM/fp-go/either"
ET "github.com/IBM/fp-go/either"
IOE "github.com/IBM/fp-go/ioeither/generic"
)
// withContext wraps an existing IOEither and performs a context check for cancellation before delegating
// WithContext wraps an existing IOEither and performs a context check for cancellation before delegating
func WithContext[GIO ~func() E.Either[error, A], A any](ctx context.Context, ma GIO) GIO {
return IOE.MakeIO[GIO](func() E.Either[error, A] {
if err := context.Cause(ctx); err != nil {
return ET.Left[A](err)
return E.Left[A](err)
}
return ma()
})