Skip to content

Instantly share code, notes, and snippets.

@kossal
Last active July 24, 2021 19:03
Show Gist options
  • Save kossal/d847ceadfbcc127d175c71fef3fe1869 to your computer and use it in GitHub Desktop.
Save kossal/d847ceadfbcc127d175c71fef3fe1869 to your computer and use it in GitHub Desktop.
getStrLn equivalent
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