在此代码段y.run
中不进行类型检查。
object Test {
type StateStringTask[A] = StateStringT[Task, A]
type StateStringT[M[_], A] = StateT[M, String, A]
val x: Process[Task, Unit] = ???
val y: Process[StateStringTask, Unit] = ???
x.run // This typechecks
y.run // This fails
}
编译器显示此错误:
could not find implicit value for parameter C: scalaz.Catchable[[x]Test.StateStringTask[x]]
我必须创建一个Catchable
实例StateStringTask
吗?我怎么做?或者在运行时是否有更简单的方法来处理有状态的效果Process
?