-
Notifications
You must be signed in to change notification settings - Fork 140
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
Implement unfoldrExactN & unfoldrExactNM #295
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation looks good, but haddock needs fixing, it still describes the behavior of unfoldrN
functions
Data/Vector.hs
Outdated
@@ -691,6 +691,15 @@ unfoldrN :: Int -> (b -> Maybe (a, b)) -> b -> Vector a | |||
{-# INLINE unfoldrN #-} | |||
unfoldrN = G.unfoldrN | |||
|
|||
-- | /O(n)/ Construct a vector with at most @n@ elements by repeatedly applying | |||
-- the generator function to a seed. The generator function yields 'Just' the | |||
-- next element and the new seed or 'Nothing' if there are no more elements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and other places the doc was copy pasted and needs fixing.
Data/Vector/Fusion/Stream/Monadic.hs
Outdated
{-# INLINE_FUSED unfoldrExactN #-} | ||
unfoldrExactN n f = unfoldrExactNM n (return . f) | ||
|
||
-- | Unfold at most @n@ elements with a monadic functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should say Unfold exactly @n@ elements ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I thought I fixed haddock... Thanks! I guess I mixed up copy-paste somewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc is still not right :)
Should say: Unfold exactly @n@ elements with a monadic function
(note function
is not plural)
457009d
to
021f57b
Compare
I think I fixed haddocks |
Data/Vector/Fusion/Bundle.hs
Outdated
@@ -437,6 +437,11 @@ unfoldrN :: Int -> (s -> Maybe (a, s)) -> s -> Bundle v a | |||
{-# INLINE unfoldrN #-} | |||
unfoldrN = M.unfoldrN | |||
|
|||
-- | Unfold at most @n@ elements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here:
Unfold exactly @n@ elements
021f57b
to
1052844
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1052844
to
8cf8345
Compare
I made a minor adjustment to this PR: lehins@ccc6e50 Once the CI passes it will be good to merge |
Fixes #140