Skip to content

Instantly share code, notes, and snippets.

@xevix
Created December 5, 2015 10:13
Show Gist options
  • Save xevix/f888187a73cf4da0cc69 to your computer and use it in GitHub Desktop.
Save xevix/f888187a73cf4da0cc69 to your computer and use it in GitHub Desktop.
Slick asTry
// Dies with:
//
// Error:(151, 98) missing parameter type for expanded function
// The argument types of an anonymous function must be fully known. (SLS 8.5)
// Expected type was: scala.util.Try[?] => ?
// coffees.length.result.flatMap(_ => DBIO.failed(new Exception())).transactionally.asTry.map {
// ^
coffees.length.result.flatMap(_ => DBIO.failed(new Exception())).transactionally.asTry.map {
case Failure(e: Throwable) => "failed"
case Success(_) => "succeeded"
}
// Splitting apart compiles
val foo = coffees.length.result.flatMap(_ => DBIO.failed(new Exception())).transactionally
foo.asTry.map {
case Failure(e: Throwable) => "failed"
case Success(_) => "succeeded"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment