Refactor fold to expose unifyType (for eventual use in instantiation)