Purely functional AVL trees in Scala