Skip to content

Commit 3a7dcff

Browse files
author
pakoito
committed
Add extfun for bindIn
1 parent 34851bd commit 3a7dcff

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kategory-core/src/main/kotlin/kategory/typeclasses/MonadContinuations.kt

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ open class MonadContinuation<F, A>(M: Monad<F>, override val context: CoroutineC
4848

4949
suspend fun <B> HK<F, B>.bind(): B = bind { this }
5050

51+
suspend fun <B> (() -> HK<F, B>).bindIn(context: CoroutineContext): B = bindIn(context, this)
52+
5153
open suspend fun <B> bind(m: () -> HK<F, B>): B = suspendCoroutineOrReturn { c ->
5254
val labelHere = c.stackLabels // save the whole coroutine stack labels
5355
returnedMonad = flatMap(m(), { x: B ->

0 commit comments

Comments
 (0)