Catching Up

It's been a long and productive summer! I wanted to take a minute to catch you up on what I've been doing since Scala Days. I went on a major job search and interviewed with a variety of companies. I landed a new job, which I feel good about, but I'll get into that later. I had the honor of writing three guest posts for the Safari Books Online Blog. And I finally put out the third monads post. In the meantime I was still at the old job, and spending a lot of quality time with my family.


Monads in Scala Part Three: Lisst[A]

We continue our Monads in Scala series by reviewing and translating the third page of the chapter on monads from the Haskell wikibook. This page takes quite an interesting view on lists, as it does not treat lists as things that you cons onto or even look things up in. It manages to treat lists nearly entirely as monadic structures. It even manages to come up with a couple of examples of using lists that only use the basic monadic operations. To view lists as things that we cons onto, we have to wait for a later page on additive monads.


Scala Days Recap and Video


I really had a blast at Scala Days this year. I met so many wonderful people, saw many wonderful talks, and had a ton of fun. I met so many great people, I can't possibly mention them all. My best memory is drinking a glass of wine at a bar with all the Scala Days attendees, when from out of the blue come Matthias Nehlsen to greet me. We have known each other on Google+ for some time, but had never met before in person. It felt like one of those Dora episodes where they all jump into the Fairy Book and go to Fairy Land.

I also got to speak to Dick Wall a bit, which was sort of a Wayne's World moment for me ("We're not worthy!"), as I used to be an avid Java Posse listener before I started writing mostly Scala. Great podcast that really helped me keep in touch with what was going on in the Java community. For Scala, I listen to the Scalawags, and I eagerly look forward to the resumption of the Scala Types podcast.

I really loved Rod Johnson's keynote. Scala poetry is a beautiful idea. I'll try to write some one day. The only point in his keynote that I question is that startups are not going to be using Scala. I don't object out of reason, but from the observation that there are many startups in the Cambridge/Boston area that are taking up Scala. There were too many great talks to start telling stories, but I won't forget asking a stupid question at Heather Miller's Pickles and Spores talk for a while. There are still many talks that I need to catch up with online. In many slots it was hard to pick between sessions!


Scripting with Scala and SBT

I wanted to write about a great experience I had with Scala and SBT today. This morning I had to write a script to convert one .csv file into another. I figured, there's no way I'm not doing this in Scala. So I sat down to write my little script. I opened up script.scala in my current directory, and started typing:

object script extends App {


Proof of Concept: Cake Pattern Type Macros

I've been using spare cycles over the last six weeks to try to put together a proof of concept implementation of the type macros I described in my Taming the Cake Pattern blog post from three months ago. I'm happy to say I have a working implementation of the first six macros! It really needs at least one more to be at all useful, and there is plenty of stuff that needs to be fleshed out. But I was very happy to learn that it was actually possible to make this happen. I'm currently compiling three examples and 27 test cases.


Scaladoc Macros

I've seen these used a lot in the Scala language source code, but I haven't gotten around to trying it until now. I have two public methods that have the same constraint on, and initially was maintaining two copies of the documentation describing the constraint:

This generated Scaladoc that looked like so:

Using Scaladoc's @macro syntax, (described in here somewhere), I can remove the repeated code as follows:

The generated Scaladoc is identical.


Monads in Scala Part Two: More Maybes

In the first installment of this series, we translated the examples from the first page of the chapter on monads in the Haskell wikibook from Haskell to Scala. In this blog post, we will continue on with the second page. This page continues with more Maybe examples, which will help us to generalize our monadic laws test for Maybes a bit. We'll also learn about kleisli composition, which composes functions suitable for passing to flatMap.

All the source code presented here is available here on GitHub. I'm compiling against Scala 2.10.1. Some of this code will not compile under Scala 2.9.x.