When I looked at scalaz.effect.IO
source code, I noticed that it has a method apply
with the following signature:
sealed trait IO[A] {
def apply(rw: Tower[IvoryTower]): Trampoline[(Tower[IvoryTower], A)]
}
Tower[A]
and IvoryTower
are defined as:
case class Tower[A]()
sealed trait IvoryTower
There is one instance of Tower
:
object IvoryTower extends IvoryTowers
trait IvoryTowers {
val ivoryTower = Tower[IvoryTower]()
}
What is the purpose of these classes? Why does IO.apply
accepts an argument of type Tower[IvoryTower]
?