Skip to content

Atry/commons-continuations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

commons-continuations is a collection of utilities which is designed to help Scala programmers to work with continuations.

Features

Allow for statement with a suspendable code block.

import com.dongxiguo.commons.continuations.CollectionConverters._
import scala.util.continuations.shiftUnit
val mySeq = Seq("foo", "bar", "baz")
val results = for (element in mySeq.asSuspendable.par) yield {
  shiftUnit("Result from a suspendable expression: " + element)
}

Hang up a continuation

import com.dongxiguo.commons.continuations.Hang
import scala.util.continuations.shift
shift(Hang)

The goto statement

import com.dongxiguo.commons.continuations.Label
val repeatPoint = Label()
doSomething()
repeatePoint.goto() // Infinite loop

Use continuation with NIO2 socket.

See AsynchronousInputStream and SocketWritingQueue.

Repository

If you use Sbt, add following lines to you build.sbt:

libraryDependencies += "com.dongxiguo" %% "commons-continuations" % "0.2.2"

Note that commons-continuations requires Scala version 2.10.x or 2.11.x.

About

Utilities for Scala continuations

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages