<@U7QUW41HP> I'm guessing you are trying to do som...
# arrow
r
@noncom I'm guessing you are trying to do something along these lines:
Copy code
object test {
    val ops: List<() -> Either<String, Int>> = listOf(
            { 1.right() },
            { 1.right() },
            { 1.right() }
            //{ "BOOM".left() }
    )

    val result: Either<String, Int> = ops.map{ it() }.reduce { a: Either<String, Int>, b: Either<String, Int> ->
        Either.monad<String>().binding {
            val x = a.bind()
            val y = b.bind()
            yields(x + y)
        }.ev()
    }
}
👍 1