1
在這個片段y.run
不typecheck。單面變壓器與scalaz流
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]]
我一定要爲StateStringTask
創建Catchable
實例?我怎麼做?或者在運行Process
時有更簡單的方法來處理有狀態的影響?