Skip to content

Widen parLiftN's constraint to NonEmptyParallel #4702

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

kubukoz
Copy link
Member

@kubukoz kubukoz commented Jan 20, 2025

Drafting to see what mima says...

@armanbilge
Copy link
Member

Unfortunately we have no MiMa support here, because syntax classes are private (which MiMa correctly ignores).

It's arguably a bug that methods on private classes are publicly usable.

@kubukoz
Copy link
Member Author

kubukoz commented Jan 21, 2025

okay, I was able to follow your advice from Discord and just created a new copy of the syntax class, except the old implicit conversion has been made non-implicit.

I tested it with the following:

main.scala:

//> using dep org.typelevel::cats-core:2.13.0
import cats.syntax.all.*
case class Foo(a: Int, b: String)

object demo extends App {
  def foo(a: Either[String, Int], b: Either[String, String]) = (Foo.apply _).parLiftN(a, b)

  println(foo(Left("error"), Right("hello")))
}

run.sh:

#!/usr/bin/env bash

set -e
set -x

for sv in 2.12 2.13 3
do
  echo "compiling $sv"

  if [ "$sv" == "2.12" ]; then
    EXTRA_FLAGS="-Ypartial-unification"
  else
    EXTRA_FLAGS=""
  fi

  scala-cli compile main.scala --output-directory out --scala "$sv" -Xsource:3 $EXTRA_FLAGS
  DEPS=$(cs fetch org.typelevel:cats-core_$sv:2.13.0-4-2d82b53-SNAPSHOT --classpath)

  echo "running: "
  java -cp "$DEPS:out" 'demo'
done

It succeeds in all versions. Does that sound about right?

@satorg
Copy link
Contributor

satorg commented Jan 21, 2025

I mean... parLiftN and friends just have been released... Can we consider risking it and ignore the binary incompatibilities there? We could quickly arrange 2.13.1 and recommend to hold on upgrading to 2.13.0 😅

Maybe no one even notice :)

@kubukoz
Copy link
Member Author

kubukoz commented Jan 21, 2025

Your call 😅

ThisBuild / tlBaseVersion := "2.12"
ThisBuild / tlBaseVersion := "2.13"
Copy link
Contributor

Choose a reason for hiding this comment

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

fyi: #4704

Copy link
Member

Choose a reason for hiding this comment

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

Actually, this PR should bump to 2.14. It's making source-breaking changes and forwards binary-breaking changes, with respect to Cats v2.13.x so we need to bump the minor to reflect that.

Copy link
Member Author

Choose a reason for hiding this comment

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

How are the changes source-breaking?

Copy link
Contributor

Choose a reason for hiding this comment

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

@kubukoz , I'm wondering too: #4704 (comment)
Perhaps there's some mystery to be unraveled :)

Copy link
Member

Choose a reason for hiding this comment

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

How are the changes source-breaking?

This code compiles in 2.13, but won't after these changes.

object syntax extends cats.syntax.FunctionApplySyntax
import syntax.*
fn.liftN(...)

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm I wonder if we can make the old syntax trait extend the new. Still, if someone hand-picks their imports they'll be source-broken. Do we care about this use case?

I don't suppose we'll release a 0.14 soon...

Copy link
Member

@armanbilge armanbilge Jan 22, 2025

Choose a reason for hiding this comment

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

Still, if someone hand-picks their imports they'll be source-broken. Do we care about this use case?

Yes, that's the point. Whenever we make any change like this, it is technically source-breaking.

To clarify, I'm not saying we should avoid source-breaking changes: this makes it impossible to add new features. What I'm saying is that, because these typical changes are source-breaking, we have to bump the base version.

@armanbilge armanbilge mentioned this pull request Feb 7, 2025
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.

3 participants