Purely functional AVL trees in Scala along with a state monad (which uses that AVL-tree). Coming to think about it, this code is actually all about the state monad and the AVL-tree is just an example for state monad usage. Take a look at the MonadExpansion.scala file to see what I am talking about.