Isn't it possible to just require the method argument `with` to be an `IndexedFile`? Now you have to cast it which can give errors.