Created
October 30, 2019 19:22
-
-
Save zeryx/b7ee39de53f24b25e7ebaff96c5f8951 to your computer and use it in GitHub Desktop.
This file contains 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
import scala.reflect.runtime.universe._ | |
import play.api.libs.json._ | |
import scala.util.{Failure, Success, Try} | |
object AbstractAlgorithm { | |
trait AbstractAlgorithm[I, O] { | |
def apply(input: I): Try[O] | |
def load(): Try[Unit] = Success(()) | |
} | |
implicit class ReadDetector[I <: AnyVal](related: AbstractAlgorithm[I, _])(implicit read: Reads[I] = Json.reads[I]) { | |
implicit def reads: Reads[I] = read | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment