Skip to content

Instantly share code, notes, and snippets.

@Jacoby6000
Forked from zeryx/Predict.scala
Last active January 5, 2017 21:15
Show Gist options
  • Save Jacoby6000/6c8830f8879c24a4e3a7ffd3b72acbb5 to your computer and use it in GitHub Desktop.
Save Jacoby6000/6c8830f8879c24a4e3a7ffd3b72acbb5 to your computer and use it in GitHub Desktop.
def apply(input: String): String = {
val output =
Utils.read[SealedTraitParent](input) match {
case Some(predict: Predict) =>
println(predict)
predict.process(client)
case Some(train: Training) =>
println(train)
train.process(client)
case None =>
println(input)
Right(new AlgorithmException(s"failed to parse"))
}
output match {
case Left(result) => Utils.Write(result).nospaces
case Right(err) => throw err
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment