Scala
Ah, Scala, the discordant symphony of the functional programming (FP) and object-oriented (OO) hybrid paradigm. As an experienced functional programmer, well-versed in Haskell, PureScript, and TypeScript (yes, even TypeScript can be written functionally), I have found myself left with conflicting feelings when it comes to Scala.
At first encounter (2011), Scala appeared to be a captivating development partner, offering an expressive canvas for writing parametric polymorphic and higher-kinded abstractions which often requires even more acrobatics in most languages. Yet today the languages available for general purpose programming should not be so encumbered. The ability to elegantly craft intricate code, weaving together complex ideas and concepts, is undeniably enticing. Like a maestro commanding an orchestra, Scala empowers me to compose symphonies of code, where the type system acts as a harmonious conductor, guiding each note to its rightful place.
Yet, amid this grand spectacle, a sense of unease lingers. A cloud of messiness hovers, obscuring the simplicity and purity that I have come to cherish in well-typed functional programming. Expressing even the simplest of ideas, like a simple algebraic data types, feels like embarking on a labyrinthine journey. Scala 2, with its idiosyncrasies, adds an extra layer of complexity that can be overwhelming. Scala 3's rendition is improved over 2's yet I feel so much opportunity was lost as the creators try to make FP-OO hybrid work instead of optimizing for FP.
The struggle to convey the elegance of algebraic data types, a cornerstone of functional programming, feels like trying to write a poignant poem using a cumbersome and convoluted vocabulary. It is a paradox: a language that simultaneously embraces and frustrates, where the richness of expressiveness coexists with uncanny verbosity.
Below there are mentions of Scala in my blogging history.
Event Sourcing for Financial Systems
Traditional databases store current state. Event sourcing stores the sequence of changes that produced that state. For financial systems where auditability, debugging, and regulatory compliance …
Flix Part 2: Smart Constructors
Smart constructors validate data at construction time, preventing invalid states from existing. This article compares smart constructor patterns in Flix and Scala 3, showing how each language encodes …
Flix Series Part 1: Higher-order functions & infix combinators
This article delves into the world of functional programming with the Flix programming language with higher-order functions and user-defined infix operators.
Flix Series Part 0: Getting Started & Setup
Are you ready to embark on a coding adventure with Flix? This article introduces Flix, a programming language that combines the best features of functional languages like Scala and Haskell. But …
Scala WTFs - moments of confusion in the Scala REPL
Small sample of Scala WTFs circa 2014 from the REPL (many taken from Paul Phillips talks on the Scala Collections library): scala> List("a", "b", "c").toSet // the only …
Scalaz By Example (An IO Taster)
Explore the building blocks in Scala using Scalaz that offer enormous benefits of algebraic thinking from domain modeling, validation, data types, and even the intricate realm of distributed systems. …
Algebraic Data Types
Unlock the power of algebraic data types to revolutionize your programming! Discover the flexibility of sum types, also known as tagged unions, and product types, also called record types. Dive into …
Functional Algebra: Monoids Applied
In functional programming, words from Category Theory are thrown around, but how useful are they really? This session looks at applications of monoids specifically and how using their algebraic …