Skip to content

Commit

Permalink
Move a bit more pure code out of delay
Browse files Browse the repository at this point in the history
  • Loading branch information
rtar committed Oct 9, 2023
1 parent c614930 commit f776bc1
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,18 @@ private[akkaeffect] object Serially {
(a, task).tailRecM { case (a, task) =>
for {
a <- task(a)
a <- Sync[F].delay {
val s = ref.getAndUpdate {
s <- Sync[F].delay {
ref.getAndUpdate {
case _: S.Active => S.Active
case S.Active => S.Idle(a)
case _: S.Idle => S.Idle(a)
}
s match {
case s: S.Active => (a, s.task).asLeft[Unit]
case S.Active => unit
case _: S.Idle => unit
}
}
} yield a
} yield s match {
case s: S.Active => (a, s.task).asLeft[Unit]
case S.Active => unit
case _: S.Idle => unit
}
}
}

Expand Down

0 comments on commit f776bc1

Please sign in to comment.