Accessing delimited continuations

Thanks to @csaltos, I figured out the syntax with a single % rather than two in the build.bt file.

addCompilerPlugin("org.scala-lang.plugins" % "scala-continuations-plugin_2.12.2" % "1.0.3")

This incantation makes sbt happy, and it is apparently able to download what it thinks it needs.

However, inside the scala code, import scala.uti8l.continuations._ does not work.

Voila, I finally got it to work!!! yipeee! Thanks everyone for the help. Especially, @agilesteel, who sent me a minimal working example (MWE)..

The grand result, is that the delimited continuations continue to work in 2.12.8, AND they work for short-circuiting a fold operation. I’ve put together a Scastie to demonstrate it. The principle being that the example function, reduceWithEscape is a simple wrapper around fold which aborts the computation if the accumulator every becomes equal to the given nullify value.

1 Like