我尝试将 scalaz 版本升级到7.2.18
. 在之前的版本中,以下代码块运行良好。
implicit val decode: DecodeJson[Uuid] =
DecodeJson( cursor =>
cursor.as[String].flatMap( str =>
DecodeResult(
\/.fromTryCatchThrowable[Uuid,IllegalArgumentException](from(str))
.leftMap(exc => (exc.getMessage, cursor.history))
) ) )
但我升级了版本,DecodeResult(...)
块给出了错误:
Type Mismatch,
expected: Either((String, CursorHistory), NotInferredA)
actual : \/((String, CursorHistory),Uuid)
如果有人能让我知道为什么会发生该错误以及上述块的正确实施,我将不胜感激。