Unify in Scala, partly finished