article thumbnail

Practical Type-Level Programming in Scala 3

Rock the JVM

Introduction Scala 3 boasts many features that are meant to simplify and enhance type-level programming: match types, inlines, diverse compile-time operations, and the list goes on. Setup The full code for all the steps can be found in this repo. You can see the setup for the post in this file and follow along using the Scala CLI tool.

Scala 94
article thumbnail

A Functional Load Balancer with Scala, Http4s and Cats Effect

Rock the JVM

Project Structure We will use Scala 3.3.0, Using a dedicated Url type makes the code more self-explanatory and provides a clear and meaningful abstraction for URLs. and several monumental libraries to complete our project. val MunitVersion = "0.7.29" val LogbackVersion = "1.4.11" val MunitCatsEffectVersion = "1.0.7" currentOpt.

Scala 105
Insiders

Sign Up for our Newsletter

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

article thumbnail

How to Write a Full-Stack Scala 3 Application with the Typelevel Stack

Rock the JVM

Introduction The Typelevel stack is one of the most powerful sets of libraries in the Scala ecosystem. They allow you to write powerful applications with pure functional programming - as of this writing, the Typelevel ecosystem is one of the biggest selling points of Scala. The Typelevel stack is based on Cats and Cats Effect.

Scala 58
article thumbnail

A guide to UDP in Scala with FS2

Rock the JVM

Setting Up Let’s create a new Scala 3 project and add the following to your build.sbt file. In the code above we use InetSocketAddress which is a subclass of SocketAddress , and in the next line, print the address it’s bound to. Here’s the full code: package com.rockthejvm.nioUdp import cats.effect. val scala3Version = "3.3.1"

Scala 90
article thumbnail

Scala CLI Tutorial: Creating a CLI Sudoku Solver

Rock the JVM

Antonio is an alumnus of Rock the JVM, now a senior Scala developer with his own contributions to Scala libraries and junior devs under his mentorship. Which brings us to this article: Antonio originally started from my Sudoku backtracking article and built a Scala CLI tutorial for the juniors he’s mentoring.

Scala 52
article thumbnail

Leveraging The Powers of Functional Code?—?Part 2

Booking.com Engineering

Leveraging The Powers of Functional Code — Part 2 The Fully Functional Haskell Solution Part one can be found here: [link] The Solution: Regarding the Haskell code — don’t worry if you don’t understand everything. It truly can change how you think about code. Math definition: (f (g x) = (f . You can read succ .

Coding 98
article thumbnail

REST APIs Using Play Framework and Scala: A Comprehensive Guide

Rock the JVM

Play Framework “makes it easy to build web applications with Java & Scala”, as it is stated on their site, and it’s true. In this article we will try to develop a basic skeleton for a REST API using Play and Scala. PlayScala plugin defines default settings for Scala-based applications. import Keys._ findById ( id ).

Scala 52