Skip to content

Instantly share code, notes, and snippets.

class Contravariance[-T]
//defined class Contravariance
val contAny:Contravariance[Any] = new Contravariance[String]
/*
<console>:8: error: type mismatch;
found : Contravariance[String]
required: Contravariance[Any]
val contAny:Contravariance[Any] = new Contravariance[String]
class Covariance[+T]
val coAny:Covariance[Any] = new Covariance[String]
// coAny: Covariance[Any] = Covariance@33a626ac
val coString:Covariance[String] = new Covariance[Any]
/*<console>:8: error: type mismatch;
found : Covariance[Any]
required: Covariance[String]
val coString:Covariance[String] = new Covariance[Any]
@theodoreLee
theodoreLee / play_future_example
Last active December 11, 2015 23:48
Play Future 처리 예제
def bbb:Future[List[String]] = future { List("hi","there") }
def failedFuture:[List[String]] = future{ throw new RuntimeException("~~") } // or Future.failed(throw new ~~())
def action1 = Action {
Async{
bbb map {
list => //list:List[String]
Ok(list.mkString("~ "))
}