Skip to content

Instantly share code, notes, and snippets.

@folone
Created October 18, 2012 12:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save folone/3911448 to your computer and use it in GitHub Desktop.
Save folone/3911448 to your computer and use it in GitHub Desktop.
State exercise
case class State[S, +A](run: S => (A, S)) {
def map[B](f: A => B): State[S, B] = sys.error("undefined")
def flatMap[B](f: A => State[S, B]): State[S, B] = sys.error("undefined")
def modify(f: S ⇒ S): State[S, A] = sys.error("undefined")
def put[S, A](s: S): State[S, Unit] = sys.error("undefined")
}
object State {
def point[S, A](a: => A): State[S, A] = sys.error("undefined")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment