cats icon indicating copy to clipboard operation
cats copied to clipboard

Widen parLiftN's constraint to NonEmptyParallel

Open kubukoz opened this issue 11 months ago • 4 comments

Drafting to see what mima says...

kubukoz avatar Jan 20 '25 23:01 kubukoz

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.

  • https://github.com/scala/bug/issues/6794

armanbilge avatar Jan 21 '25 00:01 armanbilge

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?

kubukoz avatar Jan 21 '25 00:01 kubukoz

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 :)

satorg avatar Jan 21 '25 02:01 satorg

Your call 😅

kubukoz avatar Jan 21 '25 13:01 kubukoz