veiset
08/07/2018, 1:03 PMfun <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:
Right("Something")
.map { ... }
.bind { something ->
val user = getUser().bind()
user + something
}