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

immutable.Seq missing semigroup #3624

Merged
merged 2 commits into from
Oct 9, 2020
Merged

immutable.Seq missing semigroup #3624

merged 2 commits into from
Oct 9, 2020

Conversation

JosephMoniz
Copy link
Contributor

@JosephMoniz JosephMoniz commented Oct 1, 2020

Looks like I missed adding a semigroup instances on immutable.Seq.

Before:

scala> import cats._, cats.syntax.all._, scala.collection.immutable.Seq
import cats._
import cats.syntax.all._
import scala.collection.immutable.Seq

scala> Seq(1, 2, 3) |+| Seq(3, 4, 5)
<console>:19: error: value |+| is not a member of scala.collection.immutable.Seq[Int]
       Seq(1, 2, 3) |+| Seq(3, 4, 5)

After:

scala> import cats._, cats.syntax.all._, scala.collection.immutable.Seq
import cats._
import cats.syntax.all._
import scala.collection.immutable.Seq

scala> Seq(1, 2, 3) |+| Seq(3, 4, 5)
res0: scala.collection.immutable.Seq[Int] = List(1, 2, 3, 3, 4, 5)

See: #3622

@codecov-commenter
Copy link

Codecov Report

Merging #3624 into master will decrease coverage by 0.01%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #3624      +/-   ##
==========================================
- Coverage   90.31%   90.30%   -0.02%     
==========================================
  Files         391      391              
  Lines        8869     8870       +1     
  Branches      254      249       -5     
==========================================
  Hits         8010     8010              
- Misses        859      860       +1     

Copy link
Member

@djspiewak djspiewak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think we need to talk a bit about source compatibility though and 2.12 support. These instances basically don't resolve on 2.12 because Seq is a different type. Is that something which is worth addressing?

@JosephMoniz
Copy link
Contributor Author

JosephMoniz commented Oct 2, 2020

All of these instances resolve on 2.12 just fine as long as you reference scala.collection.immutable.Seq and not scala.collection.mutable.Seq. The downside here is that in order to use any of these typeclasses in 2.12 or earlier you need to more explicitly reference immutable.Seq.

Note: My example in the original PR description is running in 2.12

In terms of source compatibility though I think this is fine for 2.12 because unless you're going out of your way to convert mutable.Seq into immutable.Seq then these changes should have no impact.

@JosephMoniz
Copy link
Contributor Author

Added some additional thoughts on source parody here: #3622 (comment)

@djspiewak djspiewak merged commit 57930ad into typelevel:master Oct 9, 2020
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.

4 participants