Scala Digest. Issue 4

Short description

The article features news and updates on various Scala libraries, including ZIO SQL, Akka with Cats-Effect 3, and Vulcan Codecs with Kafka Java APIs. It also shares recent articles and resources on Scala 3, such as Go-like channels using project Loom and Scala, good practices for system evolution with Protobuf using ScalaPB and fs2grpc, and concurrency with Cats Effect. The video section includes speeches from the Scalar Conference 2023, with discussions on topics such as the future of Future, structured concurrency with Loom integration, and full-stack Scala 3 with Typelevel Stack. The article encourages feedback and aims to promote Scala.

Scala Digest. Issue 4

Hello, Habre! We – Roma, Nastya and Karina – Tinkoff backend developers, we write code in Scala and burn with the desire to popularize it.

We collect news from various sources including Scala Times, Petr Zapletal’s blog and channel Scala Nishtyaki, we add other interesting points and our own comments. We derive our motivation from the desire to develop and share the acquired knowledge. Any feedback is welcome! (ウ ◕‿◕ )ウ

Releases

We have collected the latest updates of popular and useful libraries for a couple of months:

Articles

This section contains recent articles, repositories, and research that we found interesting. In a separate block, resources were collected where the authors use Scala 3.

  • ZIO SQL: Type-safe SQL for ZIO applications – Overview of the new library for writing SQL queries. Judging by the announcement, it combines the best of both worlds: flexibility in the form of raw SQL and the advantage of type-level validation at compile time. It’s nice to see that the authors of the article did not spare themselves to thoroughly go through and analyze the main features needed for FRM libraries: joins, connection pools, working with raw SQL, transactions and other functional joys.

  • Integrating Akka with Cats-Effect 3 — Alexandru Nedelcu came out of winter hibernation and told how it is possible to conceive a healthy child if the mother’s name is Akka and the father’s name is Cats Effect cross the Cats Effect resource management tools with Akka.

  • Lila Scavenger Hunt – We fill in the prescriptions, answering questions about the device Lichess.org. But we recommend starting from a retrospective article about setting up the service.

  • Telemetry with Scala, part 2: Kamon – Tutorial on setting up Kamon – a framework for monitoring and tracing. It is an alternative to OpenTelemetry. Unfortunately, it does not know how to export logs, but it is not inferior in everything else. The article is detailed, service code and environment settings is added

  • Using Vulcan Codecs with Kafka Java APIs — Now working with Avro in Kafka is as easy as working with JSON in Circe.

  • Beginner controls tools in Scala – comment about what scala-cli will become Scala runner and is the essence of Scala Toolkit and Typelevel Toolkit.

  • Immutability by Example — Building a Purely Functional Data Validator – practicing in writing an analogue Validated with cats-core, we master the functional paradigm of error handling.

  • Functional Error Handling in Scala – Work with errors as normal data types. Paraphrasing the author of the article: “Seven problems – flatMap is the answer” ( °ᴗ°)~ð (/❛o❛)

  • Top 10 pattern matching tips in Scala – Tips for the little ones: using pattern matching.

  • Underrated Scala Features and Hidden Gems in the Standard Library.

Articles on Scala 3

  • Go-like channels using project Loom and Scala — Adam Warski continues his very exciting experiments with the Loom project. An implementation of go-like-channels that grew out of the article about the direct-style asynchronous/concurrent programming library Ox. I did not forget to discuss the implementation of pull/push and eager/lazy models of working with streams.

  • Good practices for system evolution with Protobuf using ScalaPB and fs2grpc — a cheat sheet for all types of compatibility of fields in the contract for protobuf, as well as hacks for flexibly configuring the generation of case classes from these protobuf files.

  • Concurrency with Cats Effect – Good article about what fibers are and how to manage them in Cats Effect.

Videos and reports

We have collected links to already known and popular as well as anonymous channels and videos about Scala:

  • Java Virtual Threads — Program Java Virtual Threads, Scheduling, Cooperation and More – everything you wanted to know but were afraid to ask about virtual threads in Loom! Well, that’s not all. ┐(シ)┌ At least mentioned ForkJoin pools and semantic locks. Examples are run here to illustrate the difference with regular JVM threads.

  • Ziverge — new issues of Zymposium: writing our competition primitives for the ZIO runtime toy model and also know the mechanism behind FiberRef!

  • MUnit + Expecty = 💞

The recordings of the speeches from the Scalar Conference 2023 have appeared:

  • Martin Odersky DIRECT STYLE SCALA Scalar Conference 2023 — “there must be a witty play on words about the future of Future.” Martin Odersky – about how to reach new heights of competitiveness and asynchrony by crossing direct-style code with Future, introducing new abstractions in the form of contextual breaks (boundary/break). The talk has a couple of nice slides on how it works under the hood and how to make it easier to write real code.

  • Adam Warski OXES, TAPIRS AND STTPS SCALAR CONFERENCE 2023 – Adam Warski with an overview of Ox – a library for structured concurrency with Loom integration from JDK19 in Scala. At the end of the report, there is a comparison of this project with effects systems.

  • Wojciech Mazur THE FUTURE OF WEBASSEMBLY FOR SCALA Scalar Conference 2023 – Maintainer Scala Native about WebAssembly – about what it is and why it is needed. Two alternative approaches to supporting this framework in Scala are discussed, as well as the problems that arise in each of them. The report turned out to be informative, the editors definitely liked it (* ̄▽ ̄)b

  • Daniel Ciocîrlan FULL-STACK SCALA 3 WITH TYPELEVEL STACK Scalar Conference 2023 — RockTheJVM lit up his face live and presented a full-stack application on Scala 3, along the way talking about architecture, library selection and internals. The second half of the talk is about the UI and a small overview of Tyrian – a frontend library on Scala.js. We recommend you appreciate the beauty, it turned out really cool (ノ>ω<)ノ :。・::・゚'★,。・::・゚'☆

  • Magda Stożek GET MORE CLARITY WITH OPAQUE TYPES IN SCALA 3 Scalar Conference 2023 – 20-minute summary of best practices for working with opaque types in Scala 3. Unfortunately, at the moment, this feature cannot replace value types/type aliases/newtypes, since you still need to write boilerplate code, pattern matching does not work, and the types hidden inside cannot be reached. However, this report shows how to remedy some of these shortcomings.

  • Nicolas Rinaudo THINGS THAT ARE THINGS, BUT NOT OTHER THINGS Scalar Conference 2023 – Have you always been interested in examples of data types that can form an applicative but not a monad? You are at the right place! Report based on articlesbut watching in video format is even more pleasant.

  • Ayush Mittal IMPLICITS IN SCALA 3 Scalar Conference 2023 – Yet another speech about implicits. Patterns of working with them and how their interface has changed in Scala 3.

  • A Scala meetup organized by Kryptonite was held in Moscow:

And the other day, the ZIO World conference was held! There are no recordings of the talks yet, but we expect to see them before the next issue of the digest.

Highlights

This block is not always fresh, but the resources that caught our eye are under the banner of “smart pens”. Authors create something interesting, unusual, but not necessarily useful:

  • Scala Native for cross-platform binaries – An analogue of the csplit utility implemented on Scala Native. Of interest is not only the utility itself, but also the outlined approach to writing similar cli-applications using cats-effect and fs2.

  • Caliban — replacement of all those who are tired of REST with new ones GraphQL. We request a complex data set from the server without doing any extra calculations. Main features: built-in validator and optimizer of request handlers and client generation based on scala models. Learn more about working with the library in the cycle of articles.

  • Signals3 — a connecting link between the UI and the logic of scalaFX/javaFX/Android applications in the form of an event-streaming library running on wire-signals. Good interactive documentation comes in a set!

  • Batcher Library — the library is based on a rather interesting idea: optimizing server performance by combining identical requests in a batch and executing them at a single point. However, the given example is not representative: I would like to see the real server path.

  • ZIO Redis – The ZIO ecosystem continues its development. This time we present a native Redis client that uses the second version of zio.

Tooling

A piece of digest where we talk about new and improved development tools:

  • New Scala Build Tool – Until Eugene Yokota writes sbt 2.0John A De Goes mumbles that it should be wrong, it should be done differently paints a rainbow world of the perfect build tool for scala projects. However, he promises financial and advertising support to a startup that meets his criteria. And there is a threat to transfer the ZIO ecosystem to this magical tool.

  • Faster Scala.js development with front-end tooling and new tutorials – announcement of the vite-plugin-scalajs plugin, which allows you to make changes to your UI in real time. Everyone loves frontenders ԅ(≖‿≖ԅ) Tutorials on working with Scala.js are added

  • The Secret VS Code Hack for Indentation Guides! — DevInsideYou tells you how to take advantage of VS Code customizations not the way the developers intended.

Community-movement

This is a section with curious and interesting events in the world of scala-society, and we want to see it voluminous and alive. If we missed something or if you have suggestions, we are waiting for your comments:

  • Scala Tooling Summit Recap – A three-day Tooling Summit was held, in which most of the organizations responsible for the development of Scala took part. A list of raised topics and interim summaries of the discussion is attached.

  • Scala Center Activity Report for 2023 Q1 – Detailed report for the first quarter. Areas of work and corresponding pull requests are indicated.

  • Programming in Scala: Carbon Footprint — while you judge the quality of code by its execution speed, we judge it by the amount of carbon dioxide emitted ヽ(ˇеˇ)

  • Merger news from VirtusLab Group and by SoftwareMill – VirtusLab Group acquires SoftwareMill (๑ᵔ⤙ᵔ๑)

  • Twitter’s Recommendation Algorithm – Twitter shared the source code of the recommendation selection algorithm. It is accompanied by article with a breakdown of all the stages a tweet goes through before it hits your news feed.

  • sbt Plugins Community Repository – about the failure that occurred on April 7, with the repository repo.scala-sbt.org. In short, the paid one-year period of the artifactory instance in JFrog has expired and automatic renewal has not occurred. Work on errors is already underway.

See you in a month! ♡\( ̄▽ ̄)/♡

And here are the links to the previous issues: the first, second and third.

@ Melkaya_150cm, @ Ivoya, @ tcarina worked on the digest. We look forward to your ideas, suggestions, and feedback! <( ̄︶ ̄)>

Related posts