-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Open
kubukoz
wants to merge
7
commits into
typelevel:main
Choose a base branch
from
kubukoz:parliftn-nonemptyparallel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+65
−7
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f6dcbd4
Widen parLiftN's constraint to NonEmptyParallel
kubukoz 37f75b3
mima hacks
kubukoz 09aebbd
proper mima workaround
kubukoz 40cebce
bump source breaking version
kubukoz 6188794
format
kubukoz 6a1bb37
empty commit to kick ci for unrelated failure
kubukoz 80dd125
Add deprecation notices
kubukoz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| ThisBuild / tlBaseVersion := "2.13" | ||
| ThisBuild / tlBaseVersion := "2.14" | ||
|
|
||
| val scalaCheckVersion = "1.19.0" | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ object Boilerplate { | |
| GenParallelArityFunctions2, | ||
| GenFoldableArityFunctions, | ||
| GenFunctionSyntax, | ||
| GenFunctionSyntax2, | ||
| GenTupleParallelSyntax, | ||
| GenTupleShowInstances, | ||
| GenTupleMonadInstances, | ||
|
|
@@ -624,12 +625,11 @@ object Boilerplate { | |
| |package cats | ||
| |package syntax | ||
| | | ||
| |import cats.Functor | ||
| |import cats.Semigroupal | ||
| | | ||
| |trait FunctionApplySyntax { | ||
| | implicit def catsSyntaxFunction1Apply[T, A0](f: Function1[A0, T]): Function1ApplyOps[T, A0] = new Function1ApplyOps(f) | ||
| - implicit def catsSyntaxFunction${arity}Apply[T, ${`A..N`}](f: $function): Function${arity}ApplyOps[T, ${`A..N`}] = new Function${arity}ApplyOps(f) | ||
| | @deprecated("Use the variant that uses NonEmptyParallel instead of Parallel - catsSyntaxFunction1Apply2", "2.14.0") | ||
| | def catsSyntaxFunction1Apply[T, A0](f: Function1[A0, T]): Function1ApplyOps[T, A0] = new Function1ApplyOps(f) | ||
| - @deprecated("Use the variant that uses NonEmptyParallel instead of Parallel - catsSyntaxFunction${arity}Apply2", "2.14.0") | ||
| - def catsSyntaxFunction${arity}Apply[T, ${`A..N`}](f: $function): Function${arity}ApplyOps[T, ${`A..N`}] = new Function${arity}ApplyOps(f) | ||
| |} | ||
| | | ||
| |private[syntax] final class Function1ApplyOps[T, A0](private val f: Function1[A0, T]) extends AnyVal with Serializable { | ||
|
|
@@ -644,4 +644,38 @@ object Boilerplate { | |
| """ | ||
| } | ||
| } | ||
|
|
||
| object GenFunctionSyntax2 extends Template { | ||
| def filename(root: File) = root / "cats" / "syntax" / "FunctionApplySyntax2.scala" | ||
|
|
||
| override def range = 2 to maxArity | ||
|
|
||
| def content(tv: TemplateVals) = { | ||
| import tv.* | ||
|
|
||
| val function = s"Function$arity[${`A..N`}, T]" | ||
|
|
||
| val typedParams = synVals.zip(synTypes).map { case (v, t) => s"$v: F[$t]" }.mkString(", ") | ||
|
|
||
| block""" | ||
| |package cats | ||
| |package syntax | ||
| | | ||
| |trait FunctionApplySyntax2 { | ||
| | implicit def catsSyntaxFunction1Apply2[T, A0](f: Function1[A0, T]): Function1ApplyOps2[T, A0] = new Function1ApplyOps2(f) | ||
| - implicit def catsSyntaxFunction${arity}Apply2[T, ${`A..N`}](f: $function): Function${arity}ApplyOps2[T, ${`A..N`}] = new Function${arity}ApplyOps2(f) | ||
| |} | ||
| | | ||
| |private[syntax] final class Function1ApplyOps2[T, A0](private val f: Function1[A0, T]) extends AnyVal with Serializable { | ||
| | def liftN[F[_]: Functor](a0: F[A0]): F[T] = Functor[F].map(a0)(f) | ||
| | def parLiftN[F[_]: Functor](a0: F[A0]): F[T] = Functor[F].map(a0)(f) | ||
| |} | ||
| | | ||
| -private[syntax] final class Function${arity}ApplyOps2[T, ${`A..N`}](private val f: $function) extends AnyVal with Serializable { | ||
| - def liftN[F[_]: Functor: Semigroupal]($typedParams): F[T] = Semigroupal.map$arity(${`a..n`})(f) | ||
| - def parLiftN[F[_]: NonEmptyParallel]($typedParams): F[T] = Parallel.parMap$arity(${`a..n`})(f) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do I understand correctly that
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. correct |
||
| -} | ||
| """ | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify: you stripped
implicitof these methods because the intent is to prevent the compiler from picking them up, correct? Does it make sense to add@deprecatedto them or any other way to indicate that they shouldn't be used anymore?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes and yes!