Skip to content

Implement unfoldrExactN & unfoldrExactNM - #295

Merged
lehins merged 1 commit into
haskell:masterfrom
Shimuuar:kh/unfoldr-exact
Jun 7, 2020
Merged

lehins merged 1 commit into
haskell:masterfrom
Shimuuar:kh/unfoldr-exact

Conversation

@Shimuuar

@Shimuuar Shimuuar commented Feb 2, 2020

Copy link
Copy Markdown
Contributor

Fixes #140

@lehins lehins left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread Data/Vector.hs Outdated

-- | /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.

Copy link
Copy Markdown
Contributor

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.

Comment thread 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

Copy link
Copy Markdown
Contributor

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 ...

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Contributor

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)

@Shimuuar

Shimuuar commented Feb 3, 2020

Copy link
Copy Markdown
Contributor Author

I think I fixed haddocks

Comment thread Data/Vector/Fusion/Bundle.hs Outdated
{-# INLINE unfoldrN #-}
unfoldrN = M.unfoldrN

-- | Unfold at most @n@ elements

Copy link
Copy Markdown
Contributor

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

@lehins
lehins self-requested a review February 16, 2020 18:53

@lehins lehins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@lehins
lehins force-pushed the kh/unfoldr-exact branch from 8cf8345 to 43d02dd Compare June 7, 2020 09:14
@lehins

lehins commented Jun 7, 2020

Copy link
Copy Markdown
Contributor

I made a minor adjustment to this PR: lehins@ccc6e50

Once the CI passes it will be good to merge

@lehins
lehins merged commit 01f3e2d into haskell:master Jun 7, 2020
@Shimuuar
Shimuuar deleted the kh/unfoldr-exact branch June 19, 2020 18:15
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.

add exact size unfoldrN(M)

2 participants