You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
37 lines
1.2 KiB
package nova.monadic_sfx
|
|
|
|
import monix.eval.Task
|
|
// import sttp.client.asynchttpclient.monix.AsyncHttpClientMonixBackend
|
|
// import sttp.client._
|
|
// import sttp.client.circe._
|
|
// import io.circe.generic.auto._
|
|
import nova.monadic_sfx.executors._
|
|
import cats.effect.Resource
|
|
import sttp.client.asynchttpclient.monix.AsyncHttpClientMonixBackend
|
|
import io.odin.syntax._
|
|
import io.odin.monix._
|
|
import monix.eval.TaskApp
|
|
import cats.effect.ExitCode
|
|
import cats.implicits._
|
|
import com.softwaremill.macwire._
|
|
|
|
object Main extends MainModule with TaskApp {
|
|
|
|
override def run(args: List[String]): Task[ExitCode] = {
|
|
// val startTime = Task.clock
|
|
// .monotonic(scala.concurrent.duration.MILLISECONDS)
|
|
// .map(Duration.fromNanos(_))
|
|
lazy val appResource = for {
|
|
// clock <- Resource.liftF(Task(Task.clock))
|
|
logger <- consoleLogger().withAsync()
|
|
backend <- AsyncHttpClientMonixBackend.resource()
|
|
actorSystem <- actorSystemResource(logger)
|
|
reqs <- Resource.liftF(Task(wireWith(requesters _)))
|
|
schedulers <- Resource.liftF(Task(new Schedulers()))
|
|
fxApp <- wireWith(fxAppResource _)
|
|
} yield (fxApp)
|
|
appResource
|
|
.use(fxApp => Task(fxApp.main(args.toArray)))
|
|
.as(ExitCode.Success)
|
|
}
|
|
}
|