Skip to content

Add unsafeThaw to Data.Array.ST? #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hdgarrood opened this issue Nov 30, 2017 · 3 comments
Closed

Add unsafeThaw to Data.Array.ST? #118

hdgarrood opened this issue Nov 30, 2017 · 3 comments

Comments

@hdgarrood
Copy link
Contributor

I would like to be able to create an array using one of the existing functions for immutable arrays (e.g. range), and then use it locally within a function, but not return a reference to it. I would also like to be able to do this with a minimum of copying. Currently I think the best I can do is to use thaw or withArray, which make a copy of it; if I know that no references to my array can escape I should be able to get away without copying it. Could we possibly add an unsafeThaw, which has the same type as thaw but just returns a reference to the same array instead of copying?

@paf31
Copy link
Contributor

paf31 commented Nov 30, 2017

👍 Sounds good to me.

@matthewleon
Copy link
Contributor

Going to make a PR for this since nobody has done it, but I think it would also be nice to have PRs to implement the immutable array functions for ST arrays, even if internally they just use unsafeThaw. Any thoughts on this approach? I could make a separate issue for it.

matthewleon added a commit to matthewleon/purescript-arrays that referenced this issue Jan 19, 2018
matthewleon added a commit to matthewleon/purescript-arrays that referenced this issue Jan 20, 2018
hdgarrood pushed a commit that referenced this issue Jan 20, 2018
@hdgarrood
Copy link
Contributor Author

Resolved by #123.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants