You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test("flatMap is stack safe on repeated left binds when F is") {
valunit=StateT.pure[Eval, Unit, Unit](())
valresult= (0 until 100000).foldLeft(unit) { (acc, _) =>
acc.flatMap(_ => unit)
}
result.run(()).value should === (((), ()))
}
Note that the usual 10,000 iterations that we've been using for testing stack safety aren't enough, because for IndexedStateT the stack size doesn't grow that fast. But the error can be seen for 100,000.
This is a problem for projects like cats-effect that need to provide a lawful Sync[StateT[F, S, ?]] instance.
This test will fail with a stack overflow:
Note that the usual 10,000 iterations that we've been using for testing stack safety aren't enough, because for
IndexedStateT
the stack size doesn't grow that fast. But the error can be seen for 100,000.This is a problem for projects like
cats-effect
that need to provide a lawfulSync[StateT[F, S, ?]]
instance.NOTE: similar with #1733
The text was updated successfully, but these errors were encountered: