我定义了以下类
private sealed trait Action2[-T1, +R] extends Function1[T1, R] {
def printResults()
}
private abstract class BaseAction[T1, R] extends Action2[T1, R]{
protected var result: R = null
override final def apply(values: T1) : R = {
result = evaluate(values)
result
}
override final def printResults() {
if(result == null)
print("The results have not been evaluated!")
else
printLazyResults(result)
}
protected[this] def printLazyResults(results: R)
protected[this] def evaluate(values: T1) : R
}
我有这个类的实现,每当我尝试实例化给定的实现时,方法:
implicit def unMkIdentity[A](x: Identity[A]): A = x.value
抛出空指针异常。我首先不明白为什么调用它(我导入 scalaz 和 Scalaz)以及为什么它从属性结果中获取空值......