Cats-Actors is a typed actor library built on top of Cats Effect. With the 2.1.0 release it now runs cross-platform — the same actor code works on JVM, Scala Native, and Scala.js.
What's new
The interesting bit under the hood is the cross-platform mailbox — LinkedTransferQueue on JVM and cats.effect.std.Queue on JS and Native, behind a shared interface so your actor code never needs to know which platform it's on.
Two samples to get you started
The first is a ring benchmark — N actors relay a token for a configurable number of hops. Run it on JVM and Native and you can see the difference in throughput and startup time firsthand.
The second is a browser demo — 8 actors throwing bananas at each other, compiled to Scala.js with Slinky React and running live in the browser. You can see it in action directly in the blog post.
Links
- Blog post with full walkthrough and live demo: https://cloudmark.github.io/Cats-Actors-Native-And-JS/
- GitHub: https://github.com/cloudmark/cats-actors
Thanks to @rlavolee and @Voltir for making the cross-platform support happen!
Top comments (0)