Skip to content

Instantly share code, notes, and snippets.

@monkey-codes
Created June 9, 2023 23:30
Show Gist options
  • Select an option

  • Save monkey-codes/61a4de6c76d6ba98178cb37efeaba521 to your computer and use it in GitHub Desktop.

Select an option

Save monkey-codes/61a4de6c76d6ba98178cb37efeaba521 to your computer and use it in GitHub Desktop.
Tic Tac Toe Program
fun program(programState: ProgramState): IO<Unit> =
IOs.gameScreen(programState)
.flatMap { currentState -> IOs.gameInput(currentState) }
.flatMap { currentState -> program(currentState) }
fun main() {
either {
val game = Game.new().bind()
val p = program(game.right())
Interpreter.run(p)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment