Skip to content

Instantly share code, notes, and snippets.

@zeryx
Created January 5, 2017 22:20
Show Gist options
  • Save zeryx/aea033daee81115f215028bbd8e74293 to your computer and use it in GitHub Desktop.
Save zeryx/aea033daee81115f215028bbd8e74293 to your computer and use it in GitHub Desktop.
object Input {
implicit def inputCodec: CodecJson[Input] = {
val encoder = {
case train: Train => Train.trainCodec.encode(train)
case predict: Predict => Predict.predictCodec.encode(predict)
}
val decoder = (json: HCursor) => Predict.predictCodec.decode(json) orElse Train.trainCodec.decode(json)
CodecJson[Input](encoder, decoder)
}
}
Error:(38, 19) missing parameter type for expanded function
The argument types of an anonymous function must be fully known. (SLS 8.5)
Expected type was: ?
val encoder = {
Error:(42, 72) value orElse is not a member of argonaut.DecodeResult[algorithmia.TechSupport.Predict]
val decoder = (json: HCursor) => Predict.predictCodec.decode(json) orElse Train.trainCodec.decode(json)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment