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

fix: rework http support

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2023-07-16 22:46:18 +02:00
parent bf04dad87c
commit 48f38f2e43
20 changed files with 905 additions and 31 deletions

View File

@@ -21,11 +21,11 @@ func RightReader[E, L, A any](r R.Reader[E, A]) ReaderEither[E, L, A] {
return G.RightReader[R.Reader[E, A], ReaderEither[E, L, A]](r)
}
func LeftReader[E, L, A any](l R.Reader[E, L]) ReaderEither[E, L, A] {
func LeftReader[A, E, L any](l R.Reader[E, L]) ReaderEither[E, L, A] {
return G.LeftReader[R.Reader[E, L], ReaderEither[E, L, A]](l)
}
func Left[E, L, A any](l L) ReaderEither[E, L, A] {
func Left[E, A, L any](l L) ReaderEither[E, L, A] {
return G.Left[ReaderEither[E, L, A]](l)
}

View File

@@ -16,7 +16,7 @@ var (
func TestSequenceT1(t *testing.T) {
t1 := Of[MyContext, error]("s1")
e1 := Left[MyContext, error, string](testError)
e1 := Left[MyContext, string](testError)
res1 := SequenceT1(t1)
assert.Equal(t, E.Of[error](T.MakeTuple1("s1")), res1(defaultContext))
@@ -28,9 +28,9 @@ func TestSequenceT1(t *testing.T) {
func TestSequenceT2(t *testing.T) {
t1 := Of[MyContext, error]("s1")
e1 := Left[MyContext, error, string](testError)
e1 := Left[MyContext, string](testError)
t2 := Of[MyContext, error](2)
e2 := Left[MyContext, error, int](testError)
e2 := Left[MyContext, int](testError)
res1 := SequenceT2(t1, t2)
assert.Equal(t, E.Of[error](T.MakeTuple2("s1", 2)), res1(defaultContext))
@@ -45,11 +45,11 @@ func TestSequenceT2(t *testing.T) {
func TestSequenceT3(t *testing.T) {
t1 := Of[MyContext, error]("s1")
e1 := Left[MyContext, error, string](testError)
e1 := Left[MyContext, string](testError)
t2 := Of[MyContext, error](2)
e2 := Left[MyContext, error, int](testError)
e2 := Left[MyContext, int](testError)
t3 := Of[MyContext, error](true)
e3 := Left[MyContext, error, bool](testError)
e3 := Left[MyContext, bool](testError)
res1 := SequenceT3(t1, t2, t3)
assert.Equal(t, E.Of[error](T.MakeTuple3("s1", 2, true)), res1(defaultContext))