Skip to content

Add runSTArray for efficiently constructing arrays using ST. #152

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

Merged
merged 2 commits into from
Dec 16, 2018

Conversation

Dretch
Copy link
Contributor

@Dretch Dretch commented Dec 14, 2018

Haskell has this already. Also add a test for withArray.

I think this makes sense - please reject this pull request if not!

Haskell has this already. Also add a test for withArray.
@hdgarrood
Copy link
Contributor

As it happens, we previously had this (and not unsafeFreeze), but then we removed it at the same time we added unsafeFreeze; of course you can reconstruct this function in terms of unsafeFreeze (as you have here). I didn't realise at the time that this function is useful to have in addition to unsafeFreeze though, since of course this function allows you to obtain the benefits of unsafeFreeze while retaining more type safety. See #87, #89

So 👍 from me, although I would suggest calling it just run, as we've tried to avoid module name / function name duplication in this module.

@Dretch
Copy link
Contributor Author

Dretch commented Dec 15, 2018

@hdgarrood it is interesting to know the history behind this, thanks.

I have renamed runSTArray to run, as requested.

Copy link
Contributor

@hdgarrood hdgarrood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@garyb garyb merged commit 816d8d4 into purescript:master Dec 16, 2018
@Dretch Dretch deleted the run-st-array branch December 16, 2018 19:37
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

Successfully merging this pull request may close these issues.

3 participants