-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial version of Parallel * Add Either/Validated Parallel instance * Break up syntax for parallel * Add Parallel syntax tests * Add Tuple syntax for Parallel * Add ParallelTests * Fix Parallel law * Add more tests * Add Parallel Kleisli instance * Add instances for OptionT and EitherT to nested * Add law tests for parallel OptionT and EitherT * Make EitherT instance forward to Validated * Add Kleisli lawTest * Add WriterT instance * Add more tests * Add scaladoc * Add ApplicativeError instance for MonadError and Parallel * Add Test that actually hits the implicated ApplicativeError instance * Fix mixup * Move appError instance to Parallel companion object * Fix apperror test * Add sequential roundtrip law * Add ZipNEL and ZipNEV and Parallel instances * Add law for testing that pure is consistent across Parallel pairs * Add Parallel Serializable tests * Add EitherT Parallel instance that doesn't require a Parallel Instance for M * Add ZipVector + Parallel instance * Add ZipVector test * Add scaladoc to ApplicativeError and change order of type parameters * Add Parallel#identity function * Add identity instances for Future and Id * Simplify parAp2 implementation * Refactor Parallel * Add applicativeError instace method * Reverse applicativeError and remove redundant .apply * Simplify further * Add FailFastFuture + Parallel instance * Shorten wait times * Add ZipStream and OneAnd instance * Convert traits to abstract classes * Add consistency test for zip stream * Add Applicative test for Applicative[OneAnd] * Add parAp test * Add ZipList and lawtest all Zip* instances * Add ZipList consistency test * Add NonEmptyParallel * Add test cases for ParNonEmptyTraverse * Update scaladoc * Remove FailFastFuture and all Zip* instances * Rename methods in NonEmptyParallel * optimize AppError * Add parFlatTraverse and sequence * Revert "Remove FailFastFuture and all Zip* instances" This reverts commit c5e3423. * Add parFlatTraverse and sequence * Add isomorphic functor law * Add ZipMap? * Fix law test parameters * Remove ZipMap * Fix the priority of OneAnd instances * Rename Parallel tests * Rename Parallel tests * Add mima exceptions * Remove fail fast future
- Loading branch information
1 parent
c5f76a2
commit ef64ff8
Showing
18 changed files
with
357 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cats.data | ||
|
||
import cats.{CommutativeApply, Eq} | ||
import cats.instances.list.catsKernelStdEqForList | ||
|
||
class ZipList[A](val value: List[A]) extends AnyVal | ||
|
||
object ZipList { | ||
|
||
def apply[A](value: List[A]): ZipList[A] = new ZipList(value) | ||
|
||
implicit val catsDataCommutativeApplyForZipList: CommutativeApply[ZipList] = new CommutativeApply[ZipList] { | ||
|
||
override def map[A, B](fa: ZipList[A])(f: (A) => B): ZipList[B] = | ||
ZipList(fa.value.map(f)) | ||
|
||
def ap[A, B](ff: ZipList[A => B])(fa: ZipList[A]): ZipList[B] = | ||
ZipList((ff.value, fa.value).zipped.map(_ apply _)) | ||
|
||
override def product[A, B](fa: ZipList[A], fb: ZipList[B]): ZipList[(A, B)] = | ||
ZipList(fa.value.zip(fb.value)) | ||
|
||
} | ||
|
||
implicit def catsDataEqForZipList[A: Eq]: Eq[ZipList[A]] = Eq.by(_.value) | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package cats.data | ||
|
||
import cats.{Alternative, CommutativeApplicative, Eq} | ||
import cats.instances.stream._ | ||
|
||
class ZipStream[A](val value: Stream[A]) extends AnyVal | ||
|
||
object ZipStream { | ||
|
||
def apply[A](value: Stream[A]): ZipStream[A] = new ZipStream(value) | ||
|
||
implicit val catsDataAlternativeForZipStream: Alternative[ZipStream] with CommutativeApplicative[ZipStream] = | ||
new Alternative[ZipStream] with CommutativeApplicative[ZipStream] { | ||
def pure[A](x: A): ZipStream[A] = new ZipStream(Stream.continually(x)) | ||
|
||
override def map[A, B](fa: ZipStream[A])(f: (A) => B): ZipStream[B] = | ||
ZipStream(fa.value.map(f)) | ||
|
||
def ap[A, B](ff: ZipStream[A => B])(fa: ZipStream[A]): ZipStream[B] = | ||
ZipStream((ff.value, fa.value).zipped.map(_ apply _)) | ||
|
||
override def product[A, B](fa: ZipStream[A], fb: ZipStream[B]): ZipStream[(A, B)] = | ||
ZipStream(fa.value.zip(fb.value)) | ||
|
||
def empty[A]: ZipStream[A] = ZipStream(Stream.empty[A]) | ||
|
||
def combineK[A](x: ZipStream[A], y: ZipStream[A]): ZipStream[A] = | ||
ZipStream(Alternative[Stream].combineK(x.value, y.value)) | ||
} | ||
|
||
implicit def catsDataEqForZipStream[A: Eq]: Eq[ZipStream[A]] = Eq.by(_.value) | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cats.data | ||
|
||
import cats.{CommutativeApply, Eq} | ||
import cats.instances.vector._ | ||
|
||
class ZipVector[A](val value: Vector[A]) extends AnyVal | ||
|
||
object ZipVector { | ||
|
||
def apply[A](value: Vector[A]): ZipVector[A] = new ZipVector(value) | ||
|
||
implicit val catsDataCommutativeApplyForZipVector: CommutativeApply[ZipVector] = new CommutativeApply[ZipVector] { | ||
|
||
override def map[A, B](fa: ZipVector[A])(f: (A) => B): ZipVector[B] = | ||
ZipVector(fa.value.map(f)) | ||
def ap[A, B](ff: ZipVector[A => B])(fa: ZipVector[A]): ZipVector[B] = | ||
ZipVector((ff.value, fa.value).zipped.map(_ apply _)) | ||
|
||
} | ||
|
||
implicit def catsDataEqForZipVector[A: Eq]: Eq[ZipVector[A]] = Eq.by(_.value) | ||
} |
This file contains 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 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 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 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.