Skip to content

ST.unsafeThaw #123

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 1 commit into from
Jan 20, 2018
Merged

ST.unsafeThaw #123

merged 1 commit into from
Jan 20, 2018

Conversation

matthewleon
Copy link
Contributor

addresses #118

@@ -66,6 +68,11 @@ withArray f xs = do
unsafeFreeze :: forall a r h. STArray h a -> Eff (st :: ST h | r) (Array a)
unsafeFreeze = pure <<< (unsafeCoerce :: STArray h a -> Array a)

-- | O(1) Convert an immutable array to a mutable array, without copying. The mutable
-- | array must not be mutated.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think writing "the mutable array must not be mutated" seems to defeat the point of this function: if you have an Array a and you want to convert it into an STArray h a, that's probably because you want to mutate it, right? I think it would make more sense to say "the input array must not be used afterwards".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. Will fix.

@matthewleon
Copy link
Contributor Author

Modified according to review comment.

@hdgarrood
Copy link
Contributor

Thanks!

@hdgarrood hdgarrood merged commit 32a1a20 into purescript:master Jan 20, 2018
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.

2 participants