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

Add parTuple #2183

Merged
merged 8 commits into from
Mar 12, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Changed tupled to tuple
  • Loading branch information
barambani committed Mar 6, 2018
commit 9a8030d3151cba768b90d7109a2207c3f13e8a95
17 changes: 8 additions & 9 deletions project/Boilerplate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,13 @@ object Boilerplate {
|/**
| * @groupprio Ungrouped 0
| *
| * @groupname ParTupledArity parTupled arity
| * @groupdesc ParTupledArity Higher-arity parTupled methods
| * @groupprio ParTupledArity 999
| * @groupname ParTupleArity parTuple arity
| * @groupdesc ParTupleArity Higher-arity parTuple methods
| * @groupprio ParTupleArity 999
| */
|trait ParallelArityFunctions2 {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we make this one an abstract class then we can add more methods in the future without breaking bin compat.

Copy link
Contributor Author

@barambani barambani Mar 6, 2018

Choose a reason for hiding this comment

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

sure, changed. To avoid problems mixing in the two with Parallel I extended ParallelArityFunctions with ParallelArityFunctions2. Do you think this will prevent from adding methods in the future ? Thanks

- /** @group ParTupledArity */
- def parTupled$arity[M[_], F[_], ${`A..N`}]($fparams)(implicit p: NonEmptyParallel[M, F]): M[(${`A..N`})] =
- /** @group ParTupleArity */
- def parTuple$arity[M[_], F[_], ${`A..N`}]($fparams)(implicit p: NonEmptyParallel[M, F]): M[(${`A..N`})] =
- p.flatMap.map($nestedProducts) { case ${`nested (a..n)`} => (${`a..n`}) }
|}
"""
Expand Down Expand Up @@ -360,10 +360,9 @@ object Boilerplate {
if (arity == 1) s"def parMap[F[_], Z](f: (${`A..N`}) => Z)(implicit p: NonEmptyParallel[M, F]): M[Z] = p.flatMap.map($tupleArgs)(f)"
else s"def parMapN[F[_], Z](f: (${`A..N`}) => Z)(implicit p: NonEmptyParallel[M, F]): M[Z] = Parallel.parMap$arity($tupleArgs)(f)"

val parTupled =
val parTuple =
if (arity == 1) ""
else s"def parTupledN[F[_]](implicit p: NonEmptyParallel[M, F]): M[(${`A..N`})] = Parallel.parTupled$arity($tupleArgs)"

else s"def parTupleN[F[_]](implicit p: NonEmptyParallel[M, F]): M[(${`A..N`})] = Parallel.parTuple$arity($tupleArgs)"

block"""
|package cats
Expand All @@ -377,7 +376,7 @@ object Boilerplate {
|
-private[syntax] final class Tuple${arity}ParallelOps[M[_], ${`A..N`}]($tupleTpe) {
- $parMap
- $parTupled
- $parTuple
-}
|
"""
Expand Down