8000 Change Observable: changes for Cats & Iterant consistency by alexandru · Pull Request #408 · monix/monix · GitHub
[go: up one dir, main page]

Skip to content

Change Observable: changes for Cats & Iterant consistency - #408

Merged
alexandru merged 3 commits into
monix:masterfrom
alexandru:obs-distinct
Aug 8, 2017
Merged

alexandru merged 3 commits into
monix:masterfrom
alexandru:obs-distinct

Conversation

@alexandru
@alexandru alexandru commented Aug 8, 2017 •
Copy link
Copy Markdown
Member

Changed these operators to use cats.Eq for equality and cats.Order for ordering, thus becoming consistent with the new ops for Iterant:

  • distinctUntilChanged
  • distinctUntilChangedByKey
  • maxF / maxL
  • maxByF / maxByL
  • minF / minL
  • minByF / minByL

Added:

  • foldF / foldL as an alternative to sumL, but that uses cats.Monoid

Refactored:

  • sumF / sumL now uses foldLeftF, there's no reason for a custom implementation
  • the min/max ops now use a common implementation

Removed operators:

  • distinct
  • distinctByKey

The reason for removal is that these operators are unsafe, needing unbounded buffering and because they rely on a HashSet data-structure, for which we cannot use Cats's type classes even if we tried really hard, since we are missing a type class for "hashCode", plus it would require extra boxing, etc.

The behavior of these operators is actually easy to obtain by means of scan.

@alexandru alexandru changed the title Change Observable: change distinct operators Change Observable: changes for Cats & Iterant consistency Aug 8, 2017
@codecov
codecov Bot commented Aug 8, 2017 •
Copy link
Copy Markdown

Codecov Report

Merging #408 into master will decrease coverage by 0.15%.
The diff coverage is 94.59%.

@@            Coverage Diff             @@
##           master     #408      +/-   ##
==========================================
- Coverage   88.37%   88.21%   -0.16%     
==========================================
  Files         342      336       -6     
  Lines        9184     9069     -115     
  Branches     1207     1232      +25     
==========================================
- Hits         8116     8000     -116     
- Misses       1068     1069       +1

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0