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.

32 lines
1003 B

4 years ago
4 years ago
  1. package nova.monadic_sfx
  2. import _root_.monix.bio.BIOApp
  3. import _root_.monix.bio.Task
  4. import _root_.monix.bio.UIO
  5. import cats.effect.ExitCode
  6. import cats.effect.Resource
  7. import com.softwaremill.macwire._
  8. import io.odin._
  9. import nova.monadic_sfx.executors._
  10. // import nova.monadic_sfx.util.IOUtils._
  11. // import sttp.client.httpclient.monix.HttpClientMonixBackend
  12. object Main extends MainModule with BIOApp {
  13. def appResource(startTime: Long) =
  14. for {
  15. implicit0(logger: Logger[Task]) <- makeLogger
  16. schedulers = new Schedulers()
  17. // backend <- Resource.make(
  18. // toIO(HttpClientMonixBackend()(schedulers.async))
  19. // )(c => toIO(c.close()))
  20. // actorSystem <- actorSystemResource(logger)
  21. _ <- Resource.liftF(wire[MainApp].program)
  22. } yield ()
  23. override def run(args: List[String]): UIO[ExitCode] =
  24. appResource(System.currentTimeMillis())
  25. .use(_ => Task.unit)
  26. .onErrorHandleWith(ex => UIO(ex.printStackTrace()))
  27. .as(ExitCode.Success)
  28. }