We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fc3b155 commit 6eb5bc8Copy full SHA for 6eb5bc8
domains-Continuation/src/main/scala/com/thoughtworks/dsl/domains/Continuation.scala
@@ -3,6 +3,7 @@ package domains
3
4
import scala.util._
5
import scala.util.control.NonFatal
6
+import com.thoughtworks.dsl.keywords.Pure
7
8
type Continuation[R, +A] = (A => R) => R
9
@@ -21,7 +22,10 @@ object Continuation {
21
22
def delay[R, A](a: () => A): R !! A = _(a())
23
24
inline def apply[R, A](inline a: A): R !! A = { handler =>
- reset(handler(a))
25
+ reset {
26
+ // !Pure ensures stack safety
27
+ handler(!Pure(a))
28
+ }
29
}
30
31
def toTryContinuation[LeftDomain, Value](
0 commit comments