What is tower [A] and IvoryTower in Scalas?

When I looked at the source code of scalaz.effect.IO , I noticed that it has an apply method with the following signature:

 sealed trait IO[A] { def apply(rw: Tower[IvoryTower]): Trampoline[(Tower[IvoryTower], A)] } 

Tower[A] and IvoryTower 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 IO.apply accept an argument of type Tower[IvoryTower] ?

+8
scala io-monad scalaz
source share
1 answer

This is a joke: IvoryTower is a Haskell-type port called RealWorld . (I would like for him to have a clearer name - this person can be both impenetrable for beginners and not funny). See https://wiki.haskell.org/IO_inside .

+7
source share

All Articles