I’m trying to realise effect, which consequently union 3 effects: print to console, read this value and then print this value to console.
My code:
object ZioMain extends ZIOAppDefault {
override def run: IO[IOException, Unit]= {
def printReadPrint(): IO[IOException, Unit] = Console.print("Message")
.flatMap(_ => Console.readLine)
.flatMap(v = >Console.print(v))
}
}
So, I expected, output will be:
Message
Message
But in fact I see only one “Message” record in Console
Message
What am I doing wrong?