In the source for modify it is stated that the operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise.
But looking at the code for modify:
modify :: Vector v a => (forall s. Mutable v s a -> ST s ()) -> v a -> v a
modify p = new . New.modify p . clone
It looks to me that clone is always called (which makes sense to me, as I would think it would have to be for a destructive operation on an immutable vector).
Am I misunderstanding this? If not, what is an example of where clone is not called, and how does Data.Vector accomplish the bypass?