Skip to content

Commit

Permalink
Comment cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandru committed Dec 14, 2017
1 parent c7df430 commit b7712c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions core/shared/src/main/scala/cats/effect/IO.scala
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,8 @@ private[effect] trait IOLowPriorityInstances {
}

private[effect] trait IOInstances extends IOLowPriorityInstances {
/** [[Effect]] implementation for [[IO]]. */
implicit val ioEffect: Effect[IO] = new Effect[IO] {

implicit val ioEffect: Effect[IO] = new Effect[IO] {
override def pure[A](a: A): IO[A] =
IO.pure(a)
override def flatMap[A, B](ioa: IO[A])(f: A => IO[B]): IO[B] =
Expand Down
10 changes: 6 additions & 4 deletions laws/shared/src/main/scala/cats/effect/laws/SyncLaws.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ trait SyncLaws[F[_]] extends MonadErrorLaws[F, Throwable] {
state = f(state, a2)
F.pure(state)
}

// Observing `state` before and after `evolve`
F.map2(F.pure(state), evolve)(f) <-> F.map(fa)(a2 => f(a1, f(a1, a2)))
}

Expand All @@ -74,7 +74,7 @@ trait SyncLaws[F[_]] extends MonadErrorLaws[F, Throwable] {
state = f(state, a2)
state
}

// Observing `state` before and after `evolve`
F.map2(F.pure(state), evolve)(f) <-> F.map(fa)(a2 => f(a1, f(a1, a2)))
}

Expand All @@ -95,18 +95,20 @@ trait SyncLaws[F[_]] extends MonadErrorLaws[F, Throwable] {
}

lazy val stackSafetyOnRepeatedAttempts = {
// Note due to usage of `delay` this isn't enough to guarantee
// stack-safety, unless coupled with `bindSuspendsEvaluation`
val result = (0 until 10000).foldLeft(F.delay(())) { (acc, _) =>
F.attempt(acc).map(_ => ())
}

result <-> F.pure(())
}

lazy val stackSafetyOnRepeatedMaps = {
// Note due to usage of `delay` this isn't enough to guarantee
// stack-safety, unless coupled with `mapSuspendsEvaluation`
val result = (0 until 10000).foldLeft(F.delay(0)) { (acc, _) =>
F.map(acc)(_ + 1)
}

result <-> F.pure(10000)
}
}
Expand Down

0 comments on commit b7712c7

Please sign in to comment.