Scala type hackery