Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def execute[A](ui: UserInteraction[A]): A = ui match {
- case Tell(statement) =>
- println(statement)
- statement
- case Ask(question) =>
- println(question)
- val answer = scala.io.StdIn.readLine()
- answer.asInstanceOf[A] // to make compiler happy
- }
- def run[A](program: List[UserInteraction[A]]): Unit = program.foreach(execute)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement