Scala problem: You want to be able to read configuration files that are written in the Lightbend “Config” file format.Back to top
Lightbend — initially named Typesafe — created a configuration file format named HOCON, which stands for, “Human-Optimized Config Object Notation.” As an example, a small HOCON configuration file looks like this:
Create a Dotty project:
sbt new lampepfl/dotty.g8
Launch VS Code inside that project directory, with Dotty support:
Start SBT as usual:
Those notes are just a reminder for myself, but hopefully they’ll also help others work with Dotty, SBT, and VS Code.
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, based on a similar application in the Learn You A Haskell For Great Good book. For reasons I don’t remember, I decided not to include it in the book, and forgot about it until I started using GraalVM (“Graal”) recently.
Motivated by GraalVM, I rewrote my
sbtmkdirs command using Scala. Here’s a link to the new Scala `sbtmkdirs` project on Github.
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.
I can never remember how to create a Scala 3 (Dotty) project with SBT (in early 2019), so:
I had read that Bloop was faster than Scala compiler tools like
fsc, so I wondered if it was faster than SBT, and if so, how much faster. So I downloaded Eric Torreborre’s specs2 source code, which has 880 source code files, and compiled the entire project with both SBT and Bloop.
To test SBT’s speed, I ran all the commands from inside the SBT command prompt, which I usually do anyway to avoid the SBT/JVM startup lag time. I also ran
compile several times before recording SBT’s speed, because I thought that would be a better reflection of real-world usage and performance. I ran the tests four times, and the average time with SBT was 49 seconds, and that was very consistent, always coming in between 48 and 50 seconds.
I’ve used Jenkins before, but hadn’t used it in a while, so when I got it running with Scala, SBT, ScalaTest, and Git, I made some notes about how to configure it. You can get Jenkins going with Docker, but I just got Jenkins running by starting its WAR file like this:
java -jar jenkins.war
Jenkins with Scala, SBT, ScalaTest, and Git
My notes on getting everything up and running are a little cryptic, but if you have a little experience with Jenkins I hope they’ll make sense. Here they are:
As a brief note to self, these were the two best Jenkins tutorials I found in early 2019:
The first one shows how to run Jenkins with Docker, and the second one shows how to build a Java/Maven/Git project.
This tutorial on how to use Jenkins with Scala and SBT was also helpful:
Writing custom generators for ScalaCheck can be one of the more difficult and/or time-consuming parts of using it. As a result I thought I’d start putting together a list of generators that I have written or seen elsewhere. Unfortunately I can’t credit all the ones I’ve seen in other places because I google’d and copied them many moons ago, but I’ll give credit/attribution to all the ones I can.Back to top
This is a combination of generators I wrote, and some that I copied from other places and may have modified a little: