Skip to content

Documentation for modify confusion #371

@infinity0

Description

@infinity0

I'm a bit confused about the documentation for modify in both Data.Vector and Data.Vector.Generic:

-- | Apply a destructive operation to a vector. The operation will be
-- performed in place if it is safe to do so and will modify a copy of the
-- vector otherwise.

It's unclear to me how we can possibly detect it is "safe" to perform the operation in-place given that, due to the type signature, the caller is free to pass the input again to another function. Indeed the implementation is just modify p = new . New.modify p . clone which looks like it does an unconditional copy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions