Skip to content

Commit

Permalink
make tailRecMStackSafety lazy val (#1465)
Browse files Browse the repository at this point in the history
fixes #1463
  • Loading branch information
kailuowang authored and johnynek committed Nov 28, 2016
1 parent f01efa8 commit 47acf7f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion laws/src/main/scala/cats/laws/MonadLaws.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ trait MonadLaws[F[_]] extends ApplicativeLaws[F] with FlatMapLaws[F] {
def mapFlatMapCoherence[A, B](fa: F[A], f: A => B): IsEq[F[B]] =
fa.flatMap(a => F.pure(f(a))) <-> fa.map(f)

val tailRecMStackSafety: IsEq[F[Int]] = {
lazy val tailRecMStackSafety: IsEq[F[Int]] = {
val n = 50000
val res = F.tailRecM(0)(i => F.pure(if (i < n) Either.left(i + 1) else Either.right(i)))
res <-> F.pure(n)
Expand Down

0 comments on commit 47acf7f

Please sign in to comment.