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

Segment/Chunk usability #1012

Merged
merged 7 commits into from
Dec 5, 2017

Conversation

mpilquist
Copy link
Member

@mpilquist mpilquist commented Dec 4, 2017

This PR includes:

  • Segment operations which force evaluation of any elements have been moved to Segment.Force, resulting in syntax like s.force.toVector, s.force.run, s.force.unconsChunk. The primary motivation here is to be clear when evaluation occurs.
  • Segment no longer overrides equals and hashCode as computing these values necessarily forces the segment, which may hang if the segment is infinite.
  • Chunk is no longer a subtype of Segment. A chunk can be lifted to a segment via Segment.chunk(c) or c.toSegment. By avoiding subtyping, users know that chunk operations are always strict. This is a significant improvement over the old API where an operation on a Chunk may be strict (if defined directly on Chunk), lazy, or partially eager and partially lazy.
  • Chunk#{head,last} were changed to return Option[O] -- the only unsafe operation on Chunk is apply now.

@pchlupacek pchlupacek merged commit 72ec41a into typelevel:series/0.10 Dec 5, 2017
@mpilquist mpilquist deleted the wip/segment-usability branch February 18, 2020 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants