Skip to content

Commit

Permalink
Reformat with scalafmt 3.8.0
Browse files Browse the repository at this point in the history
Executed command: scalafmt --non-interactive
  • Loading branch information
scala-steward committed Feb 21, 2024
1 parent 1dcbec6 commit bfb6049
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ case class Operation[A](operation: () => Throwable Either A, last: Vector[Finali
try Right(run)
catch {
case NonFatal(t) => Right(Left(t))
},
last
}, last
)

def toAction: Action[A] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,7 @@ case class Producer[F[_]: Monad: Safe, A](run: F[LazyList[F, A]]):
case Done() => onLastState(s) >> done[F, A].run
case One(a) => onLastState(s) >> one[F, A](a).run
case More(as, next) =>
val newS = as.foldLeft(s)(f)
(emit[F, A](as) `append` go(next, newS)).run
val newS = as.foldLeft(s)(f)(emit[F, A](as) `append` go(next, newS)).run
}
}

Expand Down Expand Up @@ -364,8 +363,9 @@ case class Producer[F[_]: Monad: Safe, A](run: F[LazyList[F, A]]):
def go(p: Producer[F, A], previous: Vector[A]): Producer[F, (List[A], A)] =
Producer(p.peek flatMap {
case (Some(a), as) =>
val ps = if previous.size < n then previous else previous.drop(1)
(one[F, (List[A], A)]((previous.take(n).toList, a)) `append` go(as, ps :+ a)).run
val ps =
if previous.size < n then previous
else previous.drop(1)(one[F, (List[A], A)]((previous.take(n).toList, a)) `append` go(as, ps :+ a)).run
case (_, _) =>
done[F, (List[A], A)].run
})
Expand Down Expand Up @@ -445,8 +445,10 @@ case class Producer[F[_]: Monad: Safe, A](run: F[LazyList[F, A]]):
case Done() => done[F, B].run
case One(a) => one[F, B](f(previous, a)).run
case More(as, next) =>
val scanned = as.scanLeft(previous)(f).drop(1)
(emit[F, B](scanned) `append` go(next, scanned.lastOption.getOrElse(previous))).run
val scanned = as
.scanLeft(previous)(f)
.drop(1)(emit[F, B](scanned) `append` go(next, scanned.lastOption.getOrElse(previous)))
.run
})

one[F, B](start) `append` go(this, start)
Expand All @@ -458,11 +460,12 @@ case class Producer[F[_]: Monad: Safe, A](run: F[LazyList[F, A]]):
case Done() => done[F, B].run
case One(a) => one[F, B](f(a, s)._1).run
case More(as, next) =>
val (bs, news) = as.foldLeft((List[B](), s)) { case ((bs1, s1), a) =>
val (b, s2) = f(a, s1)
(bs1 :+ b, s2)
}
(emit[F, B](bs) `append` go(next, news)).run
val (bs, news) = as
.foldLeft((List[B](), s)) { case ((bs1, s1), a) =>
val (b, s2) = f(a, s1)
(bs1 :+ b, s2)
}(emit[F, B](bs) `append` go(next, news))
.run
})
go(this, start)

Expand Down Expand Up @@ -500,8 +503,7 @@ case class Producer[F[_]: Monad: Safe, A](run: F[LazyList[F, A]]):
as match {
case List() => go(next, s).run
case a :: rest =>
val (b, s1) = f(a, s)
(one[F, F[B]](b) `append` go(emit[F, A](rest) `append` next, s1)).run
val (b, s1) = f(a, s)(one[F, F[B]](b) `append` go(emit[F, A](rest) `append` next, s1)).run
}
})

Expand Down Expand Up @@ -561,11 +563,13 @@ case class Producer[F[_]: Monad: Safe, A](run: F[LazyList[F, A]]):
}

case More(as, next) =>
val (bs, news) = as.drop(1).foldLeft(f(as.head, s)) { case ((pb, s1), a) =>
val (pb1, s2) = f(a, s1)
(pb `append` pb1, s2)
}
(bs `append` go(next, news)).run
val (bs, news) = as
.drop(1)
.foldLeft(f(as.head, s)) { case ((pb, s1), a) =>
val (pb1, s2) = f(a, s1)
(pb `append` pb1, s2)
}(bs `append` go(next, news))
.run
})
go(this, start)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ case class DefaultSelector(commandLineArguments: Arguments) extends Selector:

case (fragment, sections) if !Fragment.isFormatting(fragment) && !Fragment.isEmptyText(fragment) =>
val apply = sections.sumAll
val keep = apply.keep(arguments, apply.names)
(List(newLine, fragment).filter(_ => keep), sections)
val keep = apply.keep(arguments, apply.names)(List(newLine, fragment).filter(_ => keep), sections)

case (fragment, sections) =>
(List(), sections)
Expand Down

0 comments on commit bfb6049

Please sign in to comment.