Last active
July 24, 2021 19:03
-
-
Save kossal/d847ceadfbcc127d175c71fef3fe1869 to your computer and use it in GitHub Desktop.
getStrLn equivalent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class ZIO[E, R, A](run: R => Either[E, A]) | |
val getStrLn = ZIO[Console, IOException, Unit](run: console => { | |
try { | |
// This function doesn't actually exist but you get my point | |
Right(console.readLine) | |
} catch { | |
case e: IOException => Left(e) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment