Skip to main content
Version: 1.0.18

How to Migrate from Monix to ZIO?

Monix's Task[A] can be easily replaced with ZIO's Task[A] (an alias for ZIO[Any, Throwable, A]). Translation should be relatively straightfoward. Below, you'll find tables showing the ZIO equivalents of monix.eval.Task's methods.

Once you've completed the initial translation, you'll find that ZIO is outfitted with many additional methods which have no Monix equivalents, so have fun exploring the API and see if you can rewrite some of your logic at a higher level of abstraction, with more powerful combinators and fewer lines code.

If you are using operators from from Cats Effect extension methods see also here.

Methods on Trait

MonixZIO
attempteither
bracketCasebracketExit
bracketEbracketExit
bracketbracket
delayExecutiondelay
dematerializeabsolve
doOnCancelonInterrupt
doOnFinishonExit
failedflip
flatMapflatMap
flattenflatten
guaranteeCaseensuringExit
guaranteeensuring
loopForeverforever
materializeeither
memoizememoize
onErrorFallbackToorElse
onErrorHandleWithcatchAll
onErrorRecoverWithcatchSome
onErrorRestartretryN
redeemWithfoldM
redeemfold
restartUntilrepeatUntil
startfork
timedtimed
timeouttimeout
uncancelableuninterruptible

Methods on Companion Object

MonixZIO
applyapply
asyncFeffectAsyncM
asynceffectAsync
cancelableeffectAsyncInterrupt
deferFuturefromFuture
defereffectSuspend
delayeffect
evaleffect
fromEitherfromEither
fromFuturefromFuture
fromTryfromTry
map2mapN
mapBothmapParN
nevernever
nowsucceed
parMap2mapParN
parSequenceNcollectAllParN
parSequencecollectAllPar
parTraverseNforeachParN
parTraverseforeachPar
parZip2tupledPar
puresucceed
racePairraceWith
raceraceFirst
raiseErrorfail
sequencecollectAll
shiftyield
sleepsleep
suspendeffectSuspend
traverseforeach
unitunit

Data Structures

Monix / Cats EffectZIO
DeferredPromise
FiberFiber
MVarQueue
RefRef
ResourceZManaged
SemaphoreSemaphore
TaskAppApp
TaskLocalFiberRef
TaskTask