Applying unification to type systems