Skip to content

Commit

Permalink
updated to newer Scala 3 syntax with fewer braces
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantin Läufer <[email protected]>
  • Loading branch information
klaeufer committed Oct 1, 2023
1 parent 33c2ba0 commit c050348
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/main/scala/functional/modular/common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ def runWithStdIO[Result](run: Task[String, Result], args: Array[String]): Unit =
val result = run(lines, args)
result
// terminate on I/O error such as SIGPIPE
.takeWhile { _ => !scala.sys.process.stdout.checkError() }
.foreach { r => println(r) }
.takeWhile: _ =>
!scala.sys.process.stdout.checkError()
.foreach: r =>
println(r)
6 changes: 4 additions & 2 deletions src/main/scala/functional/simple/CumAvgFunctional.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ object CumAvgFunctional:
countsWithAvgs
.drop(1)
// terminate on I/O error such as SIGPIPE
.takeWhile { _ => !scala.sys.process.stdout.checkError() }
.foreach { (count, avg) => println(s"$count: $avg") }
.takeWhile: _ =>
!scala.sys.process.stdout.checkError()
.foreach: (count, avg) =>
println(s"$count: $avg")
end CumAvgFunctional
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ object CumulativeLengthFunctional:

results
// terminate on I/O error such as SIGPIPE
.takeWhile { _ => !scala.sys.process.stdout.checkError() }
.foreach { r => println(r) }
.takeWhile: _ =>
!scala.sys.process.stdout.checkError()
.foreach: r =>
println(r)
end CumulativeLengthFunctional
6 changes: 4 additions & 2 deletions src/main/scala/functional/simple/LineCountFunctional.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ object LineCountFunctional:

results
// terminate on I/O error such as SIGPIPE
.takeWhile { r => !scala.sys.process.stdout.checkError() }
.foreach { r => println(r) }
.takeWhile: r =>
!scala.sys.process.stdout.checkError()
.foreach: r =>
println(r)
end LineCountFunctional
6 changes: 4 additions & 2 deletions src/main/scala/functional/simple/TemperatureConversion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ object TemperatureConversion:

results
// terminate on I/O error such as SIGPIPE
.takeWhile { _ => !scala.sys.process.stdout.checkError() }
.foreach { r => println(r) }
.takeWhile: _ =>
!scala.sys.process.stdout.checkError()
.foreach: r =>
println(r)
end TemperatureConversion

0 comments on commit c050348

Please sign in to comment.