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
Benchmark unfoldrN and inline createAndTrim' #128
Comments
Does |
@Bodigrim not sure but likely as you avoid testing for both length as well as whether the function returns a Just/Nothing. But even if not relevant for speed, it would be good just for completeness. |
It seems there is a low demand for this function, and it can be easily defined on the user side: unfoldrN' :: Int -> (a -> (Word8, a)) -> a -> (ByteString, a)
unfoldrN' n f s = fromJust <$> unfoldrN n (Just . f) s Thanks to I'm quite reluctant to add new functions without a good justification, because they need to be implemented at least four times (lazy/strict That said, looking at Core program for |
👍
Sounds like a good idea to me. |
A PR adding |
@Bodigrim The 4 time implementation is no fun. I agree with you that this may not be very useful. |
In many cases one wants to unfoldr exactly so many bytes (e.g base16/base64 encoding). In such cases
a version of unfoldrN of the following type is quite useful (and probably faster)
Any reason why this is not yet present.
The text was updated successfully, but these errors were encountered: