summaryrefslogtreecommitdiff
path: root/docs/examples/monads/stateInterpreter.scala
diff options
context:
space:
mode:
Diffstat (limited to 'docs/examples/monads/stateInterpreter.scala')
-rw-r--r--docs/examples/monads/stateInterpreter.scala16
1 files changed, 8 insertions, 8 deletions
diff --git a/docs/examples/monads/stateInterpreter.scala b/docs/examples/monads/stateInterpreter.scala
index 593f2d9e3e..499d97e418 100644
--- a/docs/examples/monads/stateInterpreter.scala
+++ b/docs/examples/monads/stateInterpreter.scala
@@ -49,26 +49,26 @@ object stateInterpreter {
}
def add(a: Value, b: Value): M[Value] = Pair(a, b) match {
- case Pair(Num(m), Num(n)) => for (val _ <- tickS) yield Num(m + n)
+ case Pair(Num(m), Num(n)) => for (_ <- tickS) yield Num(m + n)
case _ => unitM(Wrong)
}
def apply(a: Value, b: Value): M[Value] = a match {
- case Fun(k) => for (val _ <- tickS; val c <- k(b)) yield c
+ case Fun(k) => for (_ <- tickS; c <- k(b)) yield c
case _ => unitM(Wrong)
}
def interp(t: Term, e: Environment): M[Value] = t match {
case Var(x) => lookup(x, e)
case Con(n) => unitM(Num(n))
- case Add(l, r) => for (val a <- interp(l, e);
- val b <- interp(r, e);
- val c <- add(a, b))
+ case Add(l, r) => for (a <- interp(l, e);
+ b <- interp(r, e);
+ c <- add(a, b))
yield c
case Lam(x, t) => unitM(Fun(a => interp(t, Pair(x, a) :: e)))
- case App(f, t) => for (val a <- interp(f, e);
- val b <- interp(t, e);
- val c <- apply(a, b))
+ case App(f, t) => for (a <- interp(f, e);
+ b <- interp(t, e);
+ c <- apply(a, b))
yield c
}