https://kotlinlang.org logo
#arrow
Title
v

veiset

08/07/2018, 1:03 PM
Is something like
Copy code
fun <A, F, B> Either<F, A>.bind(block: suspend MonadContinuation<EitherPartialOf<F>, *>.(A) -> B): Either<F, B> =
        this.let {
            Either.monad<F>().binding {
                block(it.bind())
            }.fix()
        }
anything to consider for types that have a
binding
-monad? Pretty nice to be able to do:
Copy code
Right("Something")
  .map { ... }
  .bind { something -> 
    val user = getUser().bind()
    user + something
  }