我可以通过谷歌找到使用Typeable演员的所有例子都包含for表达式.这对我有用,但我想知道这是否合适.我对于无形的全新:这是我在lib中的第一次导入.
import shapeless.Typeable._
val blarg: Future[Any] = (worker ? ListOfLongsPlx(foo)) // I know Any === Try[List[Long]]
blarg.map {
_.cast[Try[List[Long]]] match {
case Some(Success(xs)) => xs
case Some(Failure(f)) => /* reporting the failure or just default: */ ; List()
case None => /*reporting bad cast just a default: */ List()
}
}
Run Code Online (Sandbox Code Playgroud)
我应该期待这种模式的问题吗?
要清楚,这是通过我的测试.