Scala world 2016

Scala Hikers @ Scarfell Pike - see here for more

I attended the scala.world conference that took place in the Lake District between the 12th and 13th September 2016. These are some notes on the conference, mainly for the benefit of my colleagues but also as a convenient way to start off the SOLID Ninja blog.

The hiking

Notes on scala.world would not be complete without mentioning the hiking that took place over the preceding weekend. The Lake District weather gods were favourable throughout the conference which was unusual to say the least (at least if you live in England). On the Saturday there was an organized hike to Scarfell Pike which is the tallest point in England and on Sunday there was a choice of cycling and hiking again. Needless to say even the "easy" route does not look like a bike ride through the Netherlands.

The hiking was a great way to meet people and talk about life rather than SI-2712.

The conference

The schedule was finally up on Monday morning about 4am - so the conference could begin!

In no particular order, these are the talks/workshops I made notes on:

Martin's Keynote

Martin Odersky was up first with a keynote titled "Compilers are (in memory) databases" (which admittedly has been given before so check below for the YouTube video). It is very nice to see that dotc has got lots of small, reasonable passes in the compiler rather than a few big monolithic passes.

watch on youtube

CBT

CBT is in my opinion the S(imple)B(uild)T(ool) that should have been - Christian did a great talk explaining how cbt emerged from the design of SBT. The slides are not yet up - here is the best I could do:

CBT looks very promising because:

  • The model is much simpler than SBT so you do not need to know about scope axes
    • I doubt anyone will be writing a book about cbt though.
  • It's fast! (both to startup and resolve dependencies)
    • No ivy involvement helps a lot in this respect, though support for coursier is currently not in a good shape
  • There is no DSL - everything is a project and tasks are functions, so you can write your own plugins etc. the same way you always write code (in Scala)

Generic derivation

I did not go to this one, but Travis Brown did an interesting talk on Generic derivation (in Circe, which is a fast json library)

The Type Astronaut's Guide to Shapeless

With a title like that it was going to be hard to disappoint, and Dave Gurnell's talk about shapeless was very good:

The worked example about doing automated case class migration (using HList union and intersection) in particular was both useful and easy to follow.

The type astronaut's guide is currently in development on GitHub.

A whirlwind tour of scala.meta

Ólafur Páll Geirsson presented a workshop on using scala.meta to automatically transform scala programs (in one example, by replacing usages of Throwable with the NonFatal(_) extractor):

watch on youtube

At this point the Internet access at the workshop was not very good, but luckily the workshop is available here: scala.meta-workshop

The Metaprogramming 2.0 talk is worth watching as well.

Talks about the Free Monad

There were a few talks/workshops on the Free Monad which is (and has been) a fairly hot topic in the past year.

Raul Raja presented a talk Run wild, Run free which gives a very natural exploration of the problem of composing your computations starting with for-comprehensions and exploring until you arrive at the free monad.

Pawel Szulc also gave a workshop on free monads: make-your-programs-free. The core idea is that while actually implementing the interpreter you get to a point where you are wrapping higher-level operations with low-level 'plumbing' code. One way of solving this problem is by definining an interpreter from a higher-level algebra to a lower-level algebra and implementing them separately (which you can see if you follow the commits in the workshop).

There were plenty of mentions to libraries that help you with free monads:12 and it would not be fair to not talk about the downsides of Free as well3.

Tuesday Keynote

The keynote on Tuesday was Dick Wall and Josh Suereth talking about all the uses of fors: Use the fors, Luke. It started off a super friendly to beginners and at the end also addressed the reasons why perhaps a for is not the ultimate tool for Monad composition (shhh, that's a lie). Unfortunately slides/video are not up yet.

Managing your Resources

This talk was one of the highlights of the conference for me I think - resource management is one of the problems in Scala that is difficult to solve because of a lack of a lifetime system as found in Rust say. And while there are more elegant ways to close() your resources after yourself, most of the solutions require either some wrapping construct (such as a for or a monad or a simple loan-pattern style closure). It is rare to see such simplicity (in Scala):

watch on youtube

The presentation is available but it's in Keynote format which GitHub does not have a reader for.

Here is a working example from the presentation:

ScalaFiddle

Scala officially entered the stage of languages with an online interactive sandbox, called ScalaFiddle. Play with it - it has decent highlighting, speed and libraries that you can use just by clicking and importing.

Tales from Compiling to the JVM

This was an interesting talk by Lukas Rytz about certain things that had to change in the Scala 2.12 compiler because of Java 8. Like not initializing static final variables outside the class initialization block. Talk is not up yet unfortunately.

Typelevel hackday

The third day of the conference was a Typelevel hackday which started off with a few talks in the morning. Of these I only took some notes for two of them:

  • Cats in London - this was Pawel Szulc attempting the what must be by-now infamous interview problem of the Checkout with apples and oranges using Cats and the Free monad
  • Array-based collections - was a nice talk about a collection library that is very different - these ones are immutable and backed by a single flat array

Other References

  • John de Goes ran an Advanced Functional Programming with Scala training workshop for 2 days prior to the conference and the linked notes look great
  • Monix was mentioned as a library quite often and I was not fully aware of it before coming to the conference

So here is the presentation from flatMap Oslo 2016 talking about it:

watch on vimeo