Bring this over from Codeblock/pkgwat-scala, but it is very incomplete.