Added IOUtils
This commit is contained in:
parent
61793d5702
commit
979cc88560
21
src/main/scala/outwatchapp/util/IOUtils.scala
Normal file
21
src/main/scala/outwatchapp/util/IOUtils.scala
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package outwatchapp.util
|
||||||
|
|
||||||
|
import cats.arrow.FunctionK
|
||||||
|
import monix.bio.IO
|
||||||
|
|
||||||
|
object IOUtils {
|
||||||
|
def toIO[T](task: monix.eval.Task[T]) =
|
||||||
|
IO.deferAction(implicit s => IO.from(task))
|
||||||
|
|
||||||
|
def toTask[T](bio: monix.bio.IO[Throwable, T]) =
|
||||||
|
monix.eval.Task.deferAction(implicit s => bio.to[monix.eval.Task])
|
||||||
|
|
||||||
|
val ioTaskMapk =
|
||||||
|
new FunctionK[monix.eval.Task, monix.bio.Task] {
|
||||||
|
|
||||||
|
override def apply[A](
|
||||||
|
fa: monix.eval.Task[A]
|
||||||
|
): monix.bio.Task[A] = toIO(fa)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user