In this snippet y.run doesn't typecheck.
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
}
The compiler shows this error:
could not find implicit value for parameter C: scalaz.Catchable[[x]Test.StateStringTask[x]]
Do I have to create a Catchable instance for StateStringTask? How do I do that? Or is there an easier way to handle stateful effects when running a Process?
I guess this is suboptimal but I got it by making
StateStringTaskan instance ofCatchable:To hoist the
StateTon aProcesswith aTaskas effect. For example: