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.

39 lines
1.2 KiB

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