[info] Running net.async.AsyncClientServer
[info] ROUTER: Received message from JILL.
[info] ROUTER: received empty:
[info] ROUTER: received message: READY
[info] DEALER: JILL received
[info] DEALER: JILL received WORLD
[info] DEALER: received ACK!
[info] ROUTER: Received message from JOE.
[info] ROUTER: received empty:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scala> sealed trait A { type T } | |
| defined trait A | |
| scala> case class AImpl(x: Int) extends A { override type T = Int } | |
| defined class AImpl | |
| scala> case class AImpl2(x: String) extends A { override type T = String } | |
| defined class AImpl2 | |
| scala> def f(x: A)(implicit ev: x.T): x.T = ev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sealed trait Result | |
| case class Good(status: Int) extends Result | |
| case class Bad(error: Int) extends Result | |
| // assume there's a `String => Int` function baked into `f` | |
| // note - I don't like `String` as a return type, but it's not the purpose | |
| // of this exercise | |
| def f(result: Result, handle: Result => String): String = ??? | |
| // assume there's a `String => Int` function baked into `f2` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package net | |
| import scala.util._ | |
| import shapeless._ | |
| object Test { | |
| case class Person(name: String, age: Double) | |
| case class PersonWrapper(person: Person, x: Int) |
After pasting Listing 19.4 (trait Queue):
scala> :paste
// Entering paste mode (ctrl-D to finish)
trait Queue[T] {
def head: T
def tail: Queue[T]
def enqueue(x: T): Queue[T]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scala> :paste | |
| // Entering paste mode (ctrl-D to finish) | |
| import play.api.libs.json._ | |
| import play.api.libs.functional.syntax._ | |
| case class Person private(age: Int) | |
| object Person { | |
| def build(age: Int): Option[Person] = |
$cat build.sbt
scalaVersion := "2.11.8"
libraryDependencies += "org.scalatest" % "scalatest_2.11" % "2.2.6"
# simply runs a test that does `assert(false)`
$sbt test
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
[info] Set current project to work (in build file:/Users/Kevin/Workspace/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "swagger": "2.0", | |
| "info": { | |
| "version": "v111", | |
| "title": "testing-april-26-kmm", | |
| "description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification", | |
| "termsOfService": "http://swagger.io/terms/", | |
| "contact": { | |
| "name": "Swagger API Team" | |
| }, |