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

package nova.monadic_sfx
import _root_.monix.bio.BIOApp
import _root_.monix.bio.Task
import _root_.monix.bio.UIO
import _root_.monix.execution.Scheduler
import cats.effect.ExitCode
import cats.effect.Resource
import com.softwaremill.macwire._
import io.odin._
import nova.monadic_sfx.executors._
import nova.monadic_sfx.util.MediaPlayerResource
// import nova.monadic_sfx.util.IOUtils._
// import sttp.client.httpclient.monix.HttpClientMonixBackend
object Main extends MainModule with BIOApp {
val schedulers = new Schedulers()
override def scheduler: Scheduler = schedulers.async
def appResource(startTime: Long) =
for {
implicit0(logger: Logger[Task]) <- makeLogger
// backend and actorsystem are for future use
// backend <- Resource.make(
// toIO(HttpClientMonixBackend()(schedulers.async))
// )(c => toIO(c.close()))
// actorSystem <- actorSystemResource(logger)
MediaPlayerResource <- MediaPlayerResource()
_ <- Resource.liftF(wire[MainApp].program)
} yield ()
override def run(args: List[String]): UIO[ExitCode] =
appResource(System.currentTimeMillis())
.use(_ => Task.unit)
.onErrorHandleWith(ex => UIO(ex.printStackTrace()))
.as(ExitCode.Success)
}