functional programming

A Scala “functional programming style” To-Do List application

Back when I was writing Functional Programming, Simplified I started to write a little Scala/FP “To-Do List” application that you can run from the command line. For reasons I don’t remember, I decided not to include it in the book, and forgot about it until I recently started using GraalVM (what I call Graal).

Graal includes a native image feature lets you compile JVM classes and JAR files into native executables, so as I thought about things I can make faster, I was reminded of the To-Do List app and thought about how cool it would be if it started instantaneously. So I found the old project, blew the dust off of it (updated all of its dependencies), and made a few additions so I could create (a) a single, executable JAR file with sbt-assembly, and (b) a native executable with Graal.

Functional error handling in Scala alvin April 22, 2019 - 9:17am

Because functional programming is like algebra, there are no null values or exceptions. But of course you can still have exceptions when you try to access servers that are down or files that are missing, so what can you do? This lesson demonstrates the techniques of functional error handling in Scala.

Functional Programming in Scala for Beginners

I see some crazy/weird critics in the world. I’ll skip the details, but yes, Functional Programming, Simplified is for beginners who are new to functional programming (FP). I wrote it because I thought many other current FP books were too hard to read, and I wasted a lot of my own time with those poorly-written resources. (Frankly, when I see that something is poorly written it makes me think that the author either doesn’t care about his readers, or doesn’t understand the subject well enough to explain it well.)

I guess I could have named my book Functional Programming in Scala for Beginners, but the key thing for me is that if you want more people to learn FP — which should be a positive thing — you need to break it down into smaller components, as I have done. The book isn’t perfect, and I hope the next edition is better, but it seems to be helping a lot of people, so I’m happy about that.

Functional programming leads to happiness

As I wrote in Functional Programming, Simplified, functional programming can lead to happiness (and sanity). The quotes in this slide from Rúnar Bjarnason’s FP talk expand on what I wrote in my book. They keys are that pure functions are very simple, and you don’t have to constantly worry about the mutable state in your application.