Skip to content

Commit

Permalink
add @tailrec
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Aug 7, 2022
1 parent 6698bd0 commit be9aeb0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion shared/src/main/scala/org/atnos/eff/Eff.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import cats._
import cats.syntax.all._
import Eff._
import EffCompat._
import scala.annotation.tailrec
import scala.concurrent.duration.FiniteDuration

/**
Expand Down Expand Up @@ -452,7 +453,8 @@ trait EffInterpretation {
/**
* get the pure value if there is no effect
*/
def runPure[R, A](eff: Eff[R, A]): Option[A] =
@tailrec
final def runPure[R, A](eff: Eff[R, A]): Option[A] =
eff match {
case Pure(a, Last(Some(l))) => l.value; Some(a)
case Pure(a, _) => Some(a)
Expand Down

0 comments on commit be9aeb0

Please sign in to comment.