-
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
add unzip and elemIndexEnd to Data.ByteString.Lazy.Char8 #294
add unzip and elemIndexEnd to Data.ByteString.Lazy.Char8 #294
Conversation
@emmanueldenloye Please ensure that Travis build is all green, even for older GHCs. They do not expose |
Cool! Please add tests as well. |
I found it strange that there weren't test for find, findIndex, and findIndices for the respective functions in Data.ByteString.Lazy.Char8. Is that an acceptable omission? |
Unfortunately, I suspect that there are many such test omissions. In the current state of the test suite it is very difficult to ensure that all four flavours of |
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.
Cool, almost there!
Please resolve merge conflicts.
tests/Properties.hs
Outdated
Just i -> Just (fromIntegral (length xs) -1 -i)) | ||
|
||
prop_elemIndexEnd2LC c xs = (LC.elemIndexEnd c (LC.pack xs)) == | ||
((-) (fromIntegral (length xs) - 1) `fmap` LC.elemIndex c (LC.pack $ reverse xs)) |
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.
What's the difference between prop_elemIndexEnd1LC
and prop_elemIndexEnd2LC
? They look equivalent to me.
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.
I saw a duplicate test elsewhere (look for prop_elemIndexEnd1LL
and prop_elemIndexEnd2LL
. I can remove the duplicates in both places if you'd like.
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.
Ah, I see. Yes, please remove other duplicates as well.
-- satisfying the predicate. | ||
findIndexEnd :: (Char -> Bool) -> ByteString -> Maybe Int64 | ||
findIndexEnd f = L.findIndexEnd (f . w2c) | ||
{-# INLINE findIndexEnd #-} |
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.
Good catch! I did not realise that findIndexEnd
is missing. Please add it to Data.ByteString.Char8
as well, and write a test.
@emmanueldenloye do you need any help with this? I'm sorry, if my review suggestions were unclear, I am happy to elaborate if needed. |
I'm sorry. I just got really busy at work. I'm going to attend to this PR again this weekend. Sorry for the holdup. |
I've checked the expected values and they seem correct. However the test is still failing for some reason that I cannot decipher. I figured I would publish this commit just to move this PR forward.
…mmanuel-add-elemindexend-and-unzip
https://travis-ci.org/github/haskell/bytestring/jobs/738655659#L659
Seems like a bad merge: your commit b30b7e8 has accidentally removed |
@emmanueldenloye is it still in flight? Do you intend to continue with this PR? |
Yes, I do. I plan to resume today in fact. Thank you for asking. |
Closed in favor of #342. Thanks for your efforts nevertheless! |
This addresses #104
I would greatly appreciate all criticism!