Skip to content

Instantly share code, notes, and snippets.

@dariathecracker
Last active June 4, 2020 12:10
Show Gist options
  • Save dariathecracker/bd77b3616e421fb9e443b470cc0dda53 to your computer and use it in GitHub Desktop.
Save dariathecracker/bd77b3616e421fb9e443b470cc0dda53 to your computer and use it in GitHub Desktop.
Tic-Tac-Toe Game ZIO
package ioleo.tictactoe
import zio.{console, App , ZEnv, ZIO}
import zio.console.Console
object TicTacToe extends App {
val program: ZIO[Console, Nothing, Unit] =
console.putStrLn("TicTacToe game!")
def run(args: List[String]): ZIO[ZEnv, Nothing, Int] =
program.foldM(
error => console.putStrLn(s"Execution failed with: $error") *> ZIO.succeed(1)
, _ => ZIO.succeed(0)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment