Skip to content

Instantly share code, notes, and snippets.

Created June 2, 2016 06:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d3a5bd03187d7cd786ed0a5270ef5c8e to your computer and use it in GitHub Desktop.
Save anonymous/d3a5bd03187d7cd786ed0a5270ef5c8e to your computer and use it in GitHub Desktop.
the description for this gist
object InterpreterId extends (Instruction ~> Id) {
import Computations._
override def apply[A](fa: Instruction[A]): Id[A] = fa match {
case Forward(p, length) => forward(p, length)
case Backward(p, length) => backward(p, length)
case RotateLeft(p, degree) => left(p, degree)
case RotateRight(p, degree) => right(p, degree)
case ShowPosition(p) => println(s"showing position $p")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment