Skip to main content

Get the Reddit app

Scan this QR code to download the app now
Or check it out in the app stores
r/scala icon
r/scala icon

r/scala

members
online

Who is hiring? Monthly /r/Scala Job Postings Thread!



Convert a program of complete side effects to cats IO? Convert a program of complete side effects to cats IO?

This is a deploy service, so its 95% side effects. I'm going through this code, that has grown over the last 7 years to a consistently working tool, via CI and humans.

There are a handful of `main` programs, so am working thought converting them to be wrapped in IO. and called within each main. Its a fail fast program, but feel the control given with IO, may make it better.

I know that is fairly vague. It was written for Ammonite, and have moved it all to Mill and pure scala. The concept of if its worth it, keeps crossing my mind.




Long division mastery in Scala.js Long division mastery in Scala.js

Last 3 releases of jsoniter-scala were focused on improving performance in Scala.js:

https://github.com/plokhotnyuk/jsoniter-scala/compare/v2.30.3...v2.30.6

The main operations that contributed on time/battery spends happened to be divisions of `Long` values on some constants during serialization of `BigDecimal`, `BigInt`, `Long`, `Float`, `Double`, `java.time.Duration` and `java.time.Instant` values.

Here are final results measured on different browsers:

https://plokhotnyuk.github.io/jsoniter-scala/index-scalajs.html

Comparison between results before and after latest optimizations:

https://jmh.morethan.io/?sources=https://raw.githubusercontent.com/plokhotnyuk/jsoniter-scala/72a00d9382292515999afb7b47906f9027c8f389/chrome.json,https://raw.githubusercontent.com/plokhotnyuk/jsoniter-scala/3f20b77b08979fb1bf2b58742ca1f908a3e0e4a9/chrome.json


Scala Space Podcast: The Future of Scala IDEs Scala Space Podcast: The Future of Scala IDEs

Hello,

I'd like to invite all of you to the next episode of the Scala Space Podcast in which my guests will be:

  • Igal Tabachnik, the author of ZIO for Intellij plugin and a long term Scala engineer

  • Jędrzej Rochala, Scala engineer working at VirtusLab, a contributor to both Metals and Scala 3 compiler

We are going to discuss new developments happening in the world of IDEs and how they are going to impact the way Scala code is written. The podcast will be happening live on Twitch and Scala Space Youtube channel today at 14:00 CEST so feel free to join the chat and ask questions. Links:

https://www.youtube.com/watch?v=I32naKlkIPk

https://www.twitch.tv/averagefpenjoyer/schedule?segmentID=aed0e121-2d47-4723-878e-95d819da4889




Braceless syntax is the most satisfying part of scala3 Braceless syntax is the most satisfying part of scala3

Not the type system extensions, not 3 new kinds of metaprogramming apis, not givens, but braceless syntax is the most noticeable thing in everyday codewriting and codereading.

It is with great pleasure to realise we won war against begin-end style boilerplate and "you can't use braceless with lambdas" pointless prejudices and now most of }}}}}}} alike eyesores can be purged with single scalafmt setting.

I cannot understand why "reviewing MR with braceless" is "harder" i mean, most of diff visualisers were able to provide unreadable diffs that would make you open both versions and compare them by eye, but aren't you review diff by imaging code which was there and how it changed? To add, diffs show spaces and, its like mostly obvious which indentation level it is. If it isn't, you have indent rainbow, which trivializes tracking.

Same story with merge conflicts - sometimes you would be able to get braces mismatch regardless, and its harder to fix than indentation mismatch.

Well, now we have (), that are the second source of unpronouceable clutter, and [] which are, as well, in some places, yet not as common. I hope someday these would be optional as well.





What web framework are you guys using? What web framework are you guys using?

I recently used Akka http + grpc + actors to create some services and an API to expose them, but I still don't know if I liked to use Akka for the API part, so I was curious what are you using specially for APIs?

Edit: damn I was not expecting so many messages thanks a lot! hahahah so apparently the way to go nowadays is something with http4s + tapir or just build the API with something else to call the scala services




Though Choice - Career Development Though Choice - Career Development

Hello everyone,

I’m currently facing a decision between two job offers and would appreciate your insights, especially from those familiar with the Scala ecosystem.

I’m based in Romania and relatively new to the industry, with a junior level of experience. Here are the details of the two offers:

1.	First Offer: This is a B2B position in a well-established outsourcing company focused on a betting project. The project is run out of Poland and involves working with Scala on a platform that is already up and running for a major client in the betting industry. The role offers about 50-60% higher compensation compared to the second option. The job provides a flexible work schedule, allowing for mid-day breaks like going to the gym. However, I have some ethical concerns regarding working in the betting industry.
2.	Second Offer: This is a permanent employment (CIM) position at another outsourcing company, but on a project that is just about to start. The project involves Python and AWS, and the salary is lower. The work hours are strict, from 9 to 18, with little flexibility.

Given the market trends, I’m inclined towards the more stable option, even though stability sometimes seems illusory if the employer decides to let you go. I have experience with both Scala and Python and try to remain language-agnostic in my career.

My question for you is:

•	Considering the current state and future of Scala in the industry, do you think the first offer has a significant advantage in terms of career development?

Thank you for your help!


Any fully opinionated framework/template for do a quick PoC on Scala? Any fully opinionated framework/template for do a quick PoC on Scala?

Hi guys, i want to start a side project and Scala is my Swiss Knife for almost everything, i want to create a crud app as fast as possible.
The main problem that i found with Cats Effect / ZIO libraries is that those are only the "effect libraries", if you want to do something you have to build it, i ended up building my own "micro-frameworks" for every (professional or hobby) project that i start and most of them are almost the same.

Any good template or unknown framework suggestion is great!.

PD: I want to do a Web Application, i already have the Tyrian app working for my front/mobile app but i'm okay working with templates too.



Scala 3 Type Lambda Scala 3 Type Lambda

I define a Bar type and a bar funtion as follows,

scala> type Bar = [X] =>> List[X] => X
// defined alias type Bar[X] = List[X] => X

scala> def bar(f:Bar[Int]) = f(List(1,2,3))
def bar(f: Bar[Int]): Int

scala> bar((xs:List[Int]) => xs.head)
val res7: Int = 1

Everything is fine. If I change =>> to => for Bar,

scala> type Bar = [X] => List[X] => X
// defined alias type Bar = [X] => (x$1: List[X]) => X

scala> def bar(f:Bar) = f(List(1,2,3))
def bar(f: Bar): Option[Int]

scala> bar((xs:List[Int]) => xs.head)
-- [E007] Type Mismatch Error: -------------------------------------------------
1 |bar((xs:List[Int]) => xs.head)
  |    ^^^^^^^^^^^^^^^^^^^^^^^^^
  |    Found:    List[Int] => Int
  |    Required: Bar

The type definition seems a valid but I cannot fit any function to bar(...) as shown above. Is there any function that can satisfy the function bar(...) or I just made a bad Bar type definition even though it compiles? Thanks




Maintenance and modernisation of Scala applications: a poll Maintenance and modernisation of Scala applications: a poll

Hello!

We are trying to better understand what things are causing the most pain for long term maintenance of applications built with Scala and to this end I've started a poll on Twitter/X at
https://x.com/lukasz_bialy/status/1808807669517402398
It would be awesome if you could vote there but if you have no such possibility, a comment here on reddit would be very helpful too. The purpose of this is for the Scala team at VirtusLab to understand where we should direct our focus and to figure out better ways to help companies that feel "stuck" with Scala-based services or data pipelines that pose a problem from maintenance perspective. If you have some horror stories about maintenance of Scala projects, feel free to share them too!


Quill - new dialects or a custom JDBC driver Quill - new dialects or a custom JDBC driver

Hi there, I'm getting to know Quill and while I like its concepts and what it offers in comparison with other JDBC libraries, I'm still trying to assess its limitations. The documentation is very short and to be honest i feel like it doesn't cover even half of questions one can have while learning the library. There are only few examples for the most basic cases, then when it comes to the Contexts section there are almost none. I have no idea when to use "lazy val ctx = new PostgresJdbcContext(SnakeCase, "ctx")" and when to simply use "quill: Quill.Postgres[SnakeCase]" from the Getting Started section.

There are 6 JDBC dialects provided by the library - H2Dialect, MySQLDialect, PostgresDialect, SqliteDialect, SQLServerDialect, OracleDialect. I wanted to ask if Quill can also be used for other databases maybe for some more generic queries, or is it better to choose a different tool for other RDB?