Skip to content

Rewrite rules for Lazy.compareLength are too lazy #507

@clyring

Description

@clyring

Lazy.length s must force the entirety of s, while (by design) Lazy.compareLength s 10 stops after finding at least 11 words. And yet we try to rewrite Lazy.length s > 10 to Lazy.compareLength s 10 == GT. I can't quickly think of any "reasonable-looking" example where this change will actually cause problems, but I am deeply skeptical of a rewrite rule that silently changes strictness behavior in this way, especially since it is common for forcing a lazy bytestring to mean performing deferred I/O actions.

(Also, Int64 overflow can happen in Lazy.length but not in Lazy.compareLength, though it's probably only possible to actually observe that difference in behavior by doing something rather stupid.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions