Skip to content
This repository was archived by the owner on Jun 10, 2021. It is now read-only.

Commit 015d6a4

Browse files
committed
Use identity function from Predef
1 parent 96e14bd commit 015d6a4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/scala/asyncstreams/AsyncStream.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ case class AsyncStream[A](data: Future[Step[A, AsyncStream[A]]]) {
4242
foldLeft(())((_: Unit, a: A) => {f(a); ()})
4343

4444
def foreachF[U](f: (A) => Future[U])(implicit executor: ExecutionContext): Future[Unit] =
45-
foldLeft(Future(()))((fu: Future[Unit], a: A) => fu.flatMap(_ => f(a)).map(_ => ())).flatMap(u => u)
45+
foldLeft(Future(()))((fu: Future[Unit], a: A) => fu.flatMap(_ => f(a)).map(_ => ())).flatMap(identity)
4646

4747
def flatten[B](implicit asIterable: A => GenIterable[B], executor: ExecutionContext): AsyncStream[B] = {
4848
val streamChunk = (p: Step[A, AsyncStream[A]]) =>

src/main/scala/asyncstreams/AsyncStreamMonad.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ trait AsyncStreamMonadFunctions {
2828
(implicit ex: ExecutionContext): FState[S, Unit] =
2929
FState(s => {
3030
stream.foldLeft(Future(s))((futureS, a) => futureS.flatMap(s2 => f(a)(s2).map(_._2)))
31-
.flatMap(f => f).map(((), _))
31+
.flatMap(identity).map(((), _))
3232
})
3333

3434
def isEmpty[A, S](stream: AsyncStream[A])(implicit ex: ExecutionContext): FState[S, Boolean] =

0 commit comments

Comments
 (0)