mirror of
https://github.com/IBM/fp-go.git
synced 2025-11-27 22:28:29 +02:00
fix: refactor
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package io
|
||||
|
||||
import (
|
||||
F "github.com/IBM/fp-go/v2/function"
|
||||
INTA "github.com/IBM/fp-go/v2/internal/apply"
|
||||
INTC "github.com/IBM/fp-go/v2/internal/chain"
|
||||
INTF "github.com/IBM/fp-go/v2/internal/functor"
|
||||
@@ -216,9 +217,7 @@ func BindL[S, T any](
|
||||
lens L.Lens[S, T],
|
||||
f Kleisli[T, T],
|
||||
) Operator[S, S] {
|
||||
return Bind[S, S, T](lens.Set, func(s S) IO[T] {
|
||||
return f(lens.Get(s))
|
||||
})
|
||||
return Bind[S, S, T](lens.Set, F.Flow2(lens.Get, f))
|
||||
}
|
||||
|
||||
// LetL attaches the result of a pure computation to a context using a lens-based setter.
|
||||
@@ -251,9 +250,7 @@ func LetL[S, T any](
|
||||
lens L.Lens[S, T],
|
||||
f func(T) T,
|
||||
) Operator[S, S] {
|
||||
return Let[S, S, T](lens.Set, func(s S) T {
|
||||
return f(lens.Get(s))
|
||||
})
|
||||
return Let[S, S, T](lens.Set, F.Flow2(lens.Get, f))
|
||||
}
|
||||
|
||||
// LetToL attaches a constant value to a context using a lens-based setter.
|
||||
|
||||
Reference in New Issue
Block a user