feat: parTraverse -> fs2
This commit is contained in:
@@ -15,6 +15,8 @@ import com.monovore.decline.effect._
|
||||
import org.typelevel.log4cats.slf4j.Slf4jLogger
|
||||
import org.typelevel.log4cats.Logger
|
||||
|
||||
import fs2.Stream
|
||||
|
||||
import assemblyIR as asm
|
||||
import cats.data.ValidatedNel
|
||||
import java.io.File
|
||||
@@ -147,8 +149,13 @@ def compileCommandParallel(
|
||||
log: Boolean,
|
||||
outDir: Option[Path]
|
||||
): IO[ExitCode] =
|
||||
files
|
||||
.parTraverse { file => compile(file.toAbsolutePath, outDir, log) }
|
||||
Stream
|
||||
.emits(files.toList)
|
||||
.parEvalMapUnordered(Runtime.getRuntime.availableProcessors()) { file =>
|
||||
compile(file.toAbsolutePath, outDir, log)
|
||||
}
|
||||
.compile
|
||||
.toList
|
||||
.map { exitCodes =>
|
||||
exitCodes.filter(_ != 0) match {
|
||||
case Nil => ExitCode.Success
|
||||
|
||||
@@ -27,7 +27,7 @@ object semantics {
|
||||
toRename = (main +: chunks).toList
|
||||
res <- toRename
|
||||
.zip(scope.subscopes(toRename.size))
|
||||
.parTraverse(checkFunc)
|
||||
.traverse(checkFunc)
|
||||
(typedChunks, errors) = res.foldLeft((Chain.empty[microWacc.FuncDecl], Chain.empty[Error])) {
|
||||
case ((acc, err), (funcDecl, errors)) =>
|
||||
(acc :+ funcDecl, err ++ errors)
|
||||
|
||||
Reference in New Issue
Block a user