Skip to content
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 compareLength for lazy bytestrings #298

Closed
Bodigrim opened this issue Oct 7, 2020 · 1 comment · Fixed by #300
Closed

Implement compareLength for lazy bytestrings #298

Bodigrim opened this issue Oct 7, 2020 · 1 comment · Fixed by #300
Milestone

Comments

@Bodigrim
Copy link
Contributor

Bodigrim commented Oct 7, 2020

It would be nice to have an implementation of

compareLength :: Data.ByteString.Lazy.ByteString -> Int -> Ordering

One could write compareLength xs n = compare (length xs) n, but this necessarily forces xs in full, which is undesirable in many use cases. We are looking for a more lazy implementation, similar in properties to Data.Text.compareLength.

@sjakobi
Copy link
Member

sjakobi commented Oct 7, 2020

Once we have an implementation, we can also add RULES similar to those in text: http://hackage.haskell.org/package/text-1.2.4.0/docs/src/Data.Text.html#compareLength

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants