Skip to content

Is the ST module at all useful? #76

@garyb

Description

@garyb

This may be a case of serious user-error problem here, but it seems to me that Record.ST is only useful in a very specific and probably not common situation: you can only use it to modify the values of existing fields in a record.

This isn't a complaint about thaw being the only way to get an STRecord, I see that there's an unreleased addition of a new - but actually this is kinda useless, since you can't do anything with an STRecord h () aside from freeze or run. You cannot use the ST interface to add or remove fields.

Given that it only allows modification, at the expense of one copy (at a minimum, two if freeze is used rather than run), it seems like this module may as well not exist - you can just modify an object with update syntax or by rebuilding it completely for the same cost.

I don't think it's fixable either - I think it could be done as an indexed monad perhaps, tracking the row in/out of each operation as the indexed part, but then it wouldn't be ST anymore either.

If I'm wrong here, apologies, can someone show me how you'd use this to build a record from scratch. 😄

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