From 8440f61e54dcd60087d5fdd6a0d3fb73934abed0 Mon Sep 17 00:00:00 2001 From: Runar Bjarnason Date: Sat, 18 Apr 2015 18:41:56 -0400 Subject: [PATCH] Fixed compilation error in 2.10 --- answers/src/main/scala/fpinscala/iomonad/Monad.scala | 2 +- exercises/src/main/scala/fpinscala/iomonad/Monad.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/answers/src/main/scala/fpinscala/iomonad/Monad.scala b/answers/src/main/scala/fpinscala/iomonad/Monad.scala index 1044dc1a9d..613901f678 100644 --- a/answers/src/main/scala/fpinscala/iomonad/Monad.scala +++ b/answers/src/main/scala/fpinscala/iomonad/Monad.scala @@ -24,7 +24,7 @@ trait Monad[F[_]] extends Functor[F] { def when[A](b: Boolean)(fa: => F[A]): F[Boolean] = if (b) as(fa)(true) else unit(false) def forever[A,B](a: F[A]): F[B] = { - val t: F[B] = a flatMap (_ => t) + lazy val t: F[B] = a flatMap (_ => t) t } def while_(a: F[Boolean])(b: F[Unit]): F[Unit] = { diff --git a/exercises/src/main/scala/fpinscala/iomonad/Monad.scala b/exercises/src/main/scala/fpinscala/iomonad/Monad.scala index b3fc266198..129c0928a3 100644 --- a/exercises/src/main/scala/fpinscala/iomonad/Monad.scala +++ b/exercises/src/main/scala/fpinscala/iomonad/Monad.scala @@ -24,7 +24,7 @@ trait Monad[F[_]] extends Functor[F] { def when[A](b: Boolean)(fa: => F[A]): F[Boolean] = if (b) as(fa)(true) else unit(false) def forever[A,B](a: F[A]): F[B] = { - val t: F[B] = a flatMap (_ => t) + lazy val t: F[B] = a flatMap (_ => t) t } def while_(a: F[Boolean])(b: F[Unit]): F[Unit] = {