We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Currently, a pattern emerges whenever we try to define all the type classes needed for the suspension functor:
trait EvalImpl { implicit val suspendedEval: Suspended[Eval] = new ( (() => ?) ~> Eval ) { override def apply[A](x: () => A): Eval[A] = Eval.always(x()) } implicit val monoidKEval: MonoidK[Eval] = new MonoidK[Eval] { override def combineK[A](e1: Eval[A], e2: Eval[A]): Eval[A] = e2 override def empty[A] = Eval.always[Nothing] { throw new NotImplementedError } } } trait FutureImpl { implicit val suspendedFuture: Suspended[Future] = new ( (() => ?) ~> Future ) { override def apply[A](x: () => A): Future[A] = Future { x() } } implicit val monoidKFuture: MonoidK[Future] = new MonoidK[Future] { override def combineK[A](e1: Future[A], e2: Future[A]): Future[A] = Future.firstCompletedOf(List(e1, e2)) override def empty[A] = Future.never } implicit val comonadFuture: Comonad[Future] = new Comonad[Future] { override def extract[A](x: Future[A]): A = Await.result(x, Duration.Inf) override def coflatMap[A, B](fa: Future[A])(f: Future[A] => B): Future[B] = map(coflatten(fa))(f) override def map[A, B](fa: Future[A])(f: A => B): Future[B] = fa.map(f) } }
Probably, these traits could be turned into type classes for arbitrary S[_]. Benefits from it:
S[_]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Currently, a pattern emerges whenever we try to define all the type classes needed for the suspension functor:
Probably, these traits could be turned into type classes for arbitrary
S[_]
. Benefits from it:The text was updated successfully, but these errors were encountered: