Skip to content

Export specialized any and all from Data.Array and Data.Array.NonEmpty #193

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 23, 2020

Conversation

kl0tl
Copy link
Member

@kl0tl kl0tl commented Dec 19, 2020

Following #189, this pull request specialize two more functions. Exporting any, all :: forall a. (a -> Boolean) -> Array a -> Boolean instead of any, all :: forall a b f. Foldable f => HeytingAlgebra b => (a -> b) -> f a -> b allows to stop iterating the array as soon as the predicate yields true for any or false for all.

@@ -1192,6 +1195,12 @@ unzip xs =
snds' <- STA.unsafeFreeze snds
pure $ Tuple fsts' snds'

-- | Returns true if at least one array element satisfy the given predicate.
Copy link
Contributor

Choose a reason for hiding this comment

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

We want “satisfies” here rather than “satisfy” for subject-verb agreement. Also, I think it would be nice to explain why we have specialised HeytingAlgebra to Boolean?

Copy link
Contributor

Choose a reason for hiding this comment

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

A couple of simple examples would also be nice, I guess

Copy link
Member Author

Choose a reason for hiding this comment

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

I updated the documentation, added some examples I fancied more than the tests and updated the tests.

Copy link
Member

@thomashoneyman thomashoneyman left a comment

Choose a reason for hiding this comment

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

Agree with Harry's comments, and otherwise this looks quite good. 👍

@kl0tl kl0tl force-pushed the specialized-any-and-all branch from 25085ad to 7bcd572 Compare December 19, 2020 23:27
@kl0tl kl0tl merged commit fab2c23 into purescript:master Dec 23, 2020
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