Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make tailRecMStackSafety lazy val #1465

Merged
merged 1 commit into from
Nov 28, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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