Skip to content

Instantly share code, notes, and snippets.

object MainX {
println("Welcome to the Scala worksheet")
sealed abstract class MyList[+T]
case object Nil extends MyList[Nothing]
case class Cons[T] (element: T, list: MyList[T]) extends MyList[T]
}
@OwenChang
OwenChang / rest.scala
Last active August 29, 2015 14:07 — forked from robi42/rest.scala
class Respond extends Service[Request, Response] with Logger {
def apply(request: Request) = {
try {
request.method -> Path(request.path) match {
case GET -> Root / "todos" => Future.value {
val data = Todos.allAsJson
debug("data: %s" format data)
Responses.json(data, acceptsGzip(request))
}
case GET -> Root / "todos" / id => Future.value {