Skip to content

Widen parLiftN's constraint to NonEmptyParallel#4702

Open
kubukoz wants to merge 6 commits into
typelevel:mainfrom
kubukoz:parliftn-nonemptyparallel
Open

Widen parLiftN's constraint to NonEmptyParallel#4702
kubukoz wants to merge 6 commits into
typelevel:mainfrom
kubukoz:parliftn-nonemptyparallel

Conversation

@kubukoz

@kubukoz kubukoz commented Jan 20, 2025

Copy link
Copy Markdown
Member

Follow-up to #4340. The current state doesn't allow for using those functions on types that don't have a pure, such as ciris's ConfigValue (which is something where people should almost always use the parallel variant...)

@armanbilge

Copy link
Copy Markdown
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

kubukoz commented Jan 21, 2025

Copy link
Copy Markdown
Member Author

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

satorg commented Jan 21, 2025

Copy link
Copy Markdown
Contributor

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

kubukoz commented Jan 21, 2025

Copy link
Copy Markdown
Member Author

Your call 😅

Comment thread build.sbt Outdated
@@ -1,4 +1,4 @@
ThisBuild / tlBaseVersion := "2.12"
ThisBuild / tlBaseVersion := "2.13"

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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...

@armanbilge armanbilge Jan 22, 2025

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

16 months later, might be a good time for 2.14 😆 bumped baseline to 0.14, let's see if this still builds.

@armanbilge armanbilge mentioned this pull request Feb 7, 2025
@kubukoz kubukoz force-pushed the parliftn-nonemptyparallel branch from 2d82b53 to 09aebbd Compare May 5, 2026 01:15
@kubukoz kubukoz marked this pull request as ready for review May 5, 2026 02:18
@kubukoz

kubukoz commented May 5, 2026

Copy link
Copy Markdown
Member Author

Let's get this one done :shipit:

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