-
Notifications
You must be signed in to change notification settings - Fork 64
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
tails, inits, initTails example implementation #214
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.
Some test cases for this would be a nice addition if you don't mind. The code looks correct overall.
I'll try to add some tests this week |
02a37e7
to
baccd02
Compare
Added tests and fixed error for list instance. Question: Should |
I honestly have no idea, I've never used that function. Is there any prior art you're aware of for a definition? |
One invariant of this function seems to be that
therefore |
I have received comment from @tomjaguarpaw above and Atijohn. Both recommend So, this is ready to go. |
@@ -472,6 +472,31 @@ class (Monoid seq, MonoTraversable seq, SemiSequence seq, MonoPointed seq) => Is | |||
splitWhen :: (Element seq -> Bool) -> seq -> [seq] | |||
splitWhen = defaultSplitWhen | |||
|
|||
-- | Returns all the final segments of 'seq' with the longest first. | |||
-- | |||
-- @since ???? |
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.
Once these are updated, I'll be happy to merge and release. Thanks!
It seems that the definitions for inits and tails differs between String and ByteString.
Benchmarks showed that some specialized instances of initTails based on splitOn were slower than the default definition, so I removed them. Added reccommended flags for benchmarking. Added change log entry.
23c5825
to
648f1f5
Compare
Thanks! |
Here is my example implementation. I have only added:
tails
,inits
,initTails
toclass IsSequence
Can you review for correctness and then I will add it to the other instances?
I am unsure how to add this to tests. How should I add the tests?
closes #213