Created
June 2, 2016 06:24
-
-
Save anonymous/d3a5bd03187d7cd786ed0a5270ef5c8e to your computer and use it in GitHub Desktop.
the description for this gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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