What method should be used to perform a side-effec...
# arrow
j
What method should be used to perform a side-effect using the value of the left side of an
Either
? I could use
fold
. But that doesn't seem quite right since
fold
`s intent seems to be more on producing a value, not performing side-effects.
👀 1
Guess I'm looking for something that takes
(A) -> Unit
.
fun Either<A, B>.foo((A) -> Unit): Either<A, B>
s
IIRC, There used to be functions on Either named tap and tapLeft, to model side-effects. A lot has changed, not sure if they are still there...
j
Ah, yes. I remember seeing those before. You're right. That was what I was looking for.