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.

GraalVM native executables can run faster than Scala/Java/JVM applications, with much less memory consumption

In two small tests where GraalVM was able to create a native executable, the native executable ran significantly faster than the equivalent Scala/Java code running with the Java 8 JVM, and also reduced RAM consumption by a whopping 98% in a long-running example. On the negative side, GraalVM currently doesn’t seem to work with Swing applications.

A note about Scala/Java startup time alvin January 15, 2019 - 4:04pm

I was reading this post by Martin Odersky (Make the Scala runtime independent of the standard library) and came across this comment by Li Haoyi: “This would also make it more feasible to use Scala for tiny bootstrap scripts; current Mill’s launcher is written in Java because the added classloading needed to use scala.Predef (even just println) easily adds a 200-400ms of initialization overhead.” I haven’t written anything where the startup time of a Scala application was a huge problem, but that was interesting to read.

(Though I should say that I wish all Scala/Java command-line apps started faster. It’s one reason I occasionally think about using Haskell for small scripts, so I can compile them to an executable.)

Scala/SBT: How to specify a main method/class to run

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.9, “Specifying a Main Class to Run with SBT.”


In a Scala SBT project, you have multiple main methods in objects in your project, and you want to specify which main method should be run when you type sbt run, or specify the main method that should be invoked when your project is packaged as a JAR file.

Scala/SBT: How to deploy a single, executable Jar file

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.14, “How to Deploy a Single, Executable JAR File.”


You’re building a Scala application, such as a Swing application, and want to deploy a single, executable JAR file to your users.

Linux chmod - how to make a Perl script executable

Linux chmod FAQ: Can you share an example of how to make a shell script executable with the Unix/Linux chmod command?

A lot of times in the web world you're given a Perl script by someone, and they say, "Put this script on your server, make it executable, and yada yada yada." Skipping the yada-yada part, some times people gloss over the "Make this file executable" part. So, here's a quick lesson of how to use the Linux chmod command to make a Perl script (or any Unix file) executable.