-
-
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.
- Loading branch information
Showing
4 changed files
with
39 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package cats | ||
package syntax | ||
|
||
trait ApplicativeSyntax1 { | ||
implicit def applicativeSyntaxU[FA](fa: FA)(implicit U: Unapply[Applicative, FA]): Applicative.Ops[U.M, U.A] = | ||
new Applicative.Ops[U.M, U.A] { | ||
val self = U.subst(fa) | ||
val typeClassInstance = U.TC | ||
} | ||
} | ||
|
||
trait ApplicativeSyntax extends ApplicativeSyntax1 { | ||
implicit def applicativeSyntax[F[_], A](fa: F[A])(implicit F: Applicative[F]): Applicative.Ops[F, A] = | ||
new Applicative.Ops[F,A] { | ||
val self = fa | ||
val typeClassInstance = F | ||
} | ||
implicit def applicativeIdSyntax[A](a: A): ApplicativeIdOps[A] = new ApplicativeIdOps[A](a) | ||
implicit def applicativeEvalSyntax[A](a: Eval[A]): ApplicativeEvalOps[A] = new ApplicativeEvalOps[A](a) | ||
} | ||
|
||
final class ApplicativeIdOps[A](val a: A) extends AnyVal { | ||
def pure[F[_]](implicit F: Applicative[F]): F[A] = F.pure(a) | ||
} | ||
|
||
final class ApplicativeEvalOps[A](val a: Eval[A]) extends AnyVal { | ||
def pureEval[F[_]](implicit F: Applicative[F]): F[A] = F.pureEval(a) | ||
} |
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