Learn You a Haskell for Great Good code translated to Scala