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.
 
 
 

23 lines
495 B

package nova.monadic_sfx.util
import monix.eval.Task
import monix.execution.Scheduler
import cats.effect.Effect
import cats.effect.implicits._
object Action {
/**
* Implicitly runs monix task as fire and forget. \
* For use in ScalaFX callbacks.
*
* @param task
* @param s
*/
def asyncT[T](task: => Task[T])(implicit s: Scheduler): Unit = {
task.runAsyncAndForget
}
def asyncF[F[_]: Effect, T](cb: => F[T]): Unit =
cb.toIO.unsafeRunAsyncAndForget()
}