Bubble Foundry


Hacking in Scala

by Peter.

Two weeks ago I attended CPH Scala and gave a little presentation on ‘hacking in Scala’. As I see it, that means just using Scala for all sorts of projects, from bigger ones to little utilities thrown together in an hour or two. In general I’m quite happy with things, though I am always looking for was to speed up my process. sbt and lifty have helped a lot, though I think there’s still room for improvement.

Here’s the slides I threw together right before the meetup:

Just the other day I saw that Richard gave a presentation to Functional Brighton about his everyday functional programming in Scala. I think it’s quite nice and in a similar spirit of mine.

Today I put together a new tool I call sketch that I hope will help me become even more productive in quickly doing little things in Scala. Put simply, it’s just a bash command that launches the scala REPL with a bunch of JARs I commonly use (dispatch, lift-common, lift-json, etc). The JARs are in ~/.sketch/ and this is my command:

# scala interpreter with usual jars included in the classpath
sketch () {
    SKETCH_JAR_HOME=/Users/peter/.sketch
 
    for f in $SKETCH_JAR_HOME/*.jar
    do
        SKETCH_JAR_CLASSPATH=$SKETCH_JAR_CLASSPATH:$f
    done
 
    scala -classpath $SKETCH_JAR_CLASSPATH
}