Skip to content

Commit

Permalink
Update Scalafmt
Browse files Browse the repository at this point in the history
  • Loading branch information
travisbrown committed Dec 9, 2019
1 parent 40e8f2c commit 620295a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
@@ -1,4 +1,4 @@
version = 2.2.2
version = 2.3.2
continuationIndent.defnSite = 2
docstrings = JavaDoc
includeCurlyBraceInSelectChains = false
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/scala/io/iteratee/Iteratee.scala
Expand Up @@ -116,8 +116,9 @@ sealed class Iteratee[F[_], E, A] private[iteratee] (final val state: F[Step[F,
* or not it succeeds.
*/
final def ensureEval[T](action: Eval[F[Unit]])(implicit F: MonadError[F, T]): Iteratee[F, E, A] =
handleErrorWith[T](_ => Iteratee.iteratee(F.flatMap(action.value)(_ => state)))
.flatMapM(result => F.map(action.value)(_ => result))
handleErrorWith[T](_ => Iteratee.iteratee(F.flatMap(action.value)(_ => state))).flatMapM(result =>
F.map(action.value)(_ => result)
)
}

private[iteratee] class IterateeLowPriorityInstances {
Expand Down
1 change: 1 addition & 0 deletions core/src/main/scala/io/iteratee/internal/Step.scala
Expand Up @@ -13,6 +13,7 @@ import cats.data.NonEmptyList
* @tparam A The type of the result calculated by the [[io.iteratee.Iteratee]]
*/
sealed abstract class Step[F[_], E, A] extends Serializable {

/**
* Reduce this [[Step]] to a value using the given functions.
*/
Expand Down
22 changes: 10 additions & 12 deletions files/src/main/scala/io/iteratee/files/package.scala
Expand Up @@ -53,25 +53,23 @@ package object files {
def writeLines[F[_]](file: File)(implicit F: Sync[F]): Iteratee[F, String, Unit] =
Iteratee.liftM(F.delay(new BufferedWriter(new FileWriter(file)))).flatMap { writer =>
Iteratee
.foldM[F, String, Unit](())(
(_, line) =>
F.delay {
writer.write(line)
writer.newLine()
}
.foldM[F, String, Unit](())((_, line) =>
F.delay {
writer.write(line)
writer.newLine()
}
)
.ensure(F.delay(writer.close()))
}

def writeLinesToStream[F[_]](stream: OutputStream)(implicit F: Sync[F]): Iteratee[F, String, Unit] =
Iteratee.liftM(F.delay(new BufferedWriter(new OutputStreamWriter(stream)))).flatMap { writer =>
Iteratee
.foldM[F, String, Unit](())(
(_, line) =>
F.delay {
writer.write(line)
writer.newLine()
}
.foldM[F, String, Unit](())((_, line) =>
F.delay {
writer.write(line)
writer.newLine()
}
)
.ensure(F.delay(writer.close()))
}
Expand Down
Expand Up @@ -56,6 +56,7 @@ trait FutureSuite extends FutureModule {
}

object FutureSuite {

/**
* Needed because `scala.concurrent.Future` boxes `java.lang.Error`.
*/
Expand Down

0 comments on commit 620295a

Please sign in to comment.