Skip to content

Commit 6eb5bc8

Browse files
committed
Let Continuation support ToView.FromIterable
1 parent fc3b155 commit 6eb5bc8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

domains-Continuation/src/main/scala/com/thoughtworks/dsl/domains/Continuation.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package domains
33

44
import scala.util._
55
import scala.util.control.NonFatal
6+
import com.thoughtworks.dsl.keywords.Pure
67

78
type Continuation[R, +A] = (A => R) => R
89

@@ -21,7 +22,10 @@ object Continuation {
2122
def delay[R, A](a: () => A): R !! A = _(a())
2223

2324
inline def apply[R, A](inline a: A): R !! A = { handler =>
24-
reset(handler(a))
25+
reset {
26+
// !Pure ensures stack safety
27+
handler(!Pure(a))
28+
}
2529
}
2630

2731
def toTryContinuation[LeftDomain, Value](

0 commit comments

Comments
 (0)