File tree Expand file tree Collapse file tree
core/src/main/scala/cats/syntax
tests/src/test/scala/cats/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ package cats
22package syntax
33
44trait AllSyntax
5- extends ApplySyntax
5+ extends ApplicativeSyntax
6+ with ApplySyntax
67 with BifunctorSyntax
78 with BifoldableSyntax
89 with CartesianSyntax
Original file line number Diff line number Diff line change 1+ package cats
2+ package syntax
3+
4+ trait ApplicativeSyntax {
5+ implicit def applicativeIdSyntax [A ](a : A ): ApplicativeIdOps [A ] = new ApplicativeIdOps [A ](a)
6+ implicit def applicativeEvalSyntax [A ](a : Eval [A ]): ApplicativeEvalOps [A ] = new ApplicativeEvalOps [A ](a)
7+ }
8+
9+ final class ApplicativeIdOps [A ](val a : A ) extends AnyVal {
10+ def pure [F [_]](implicit F : Applicative [F ]): F [A ] = F .pure(a)
11+ }
12+
13+ final class ApplicativeEvalOps [A ](val a : Eval [A ]) extends AnyVal {
14+ def pureEval [F [_]](implicit F : Applicative [F ]): F [A ] = F .pureEval(a)
15+ }
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package cats
22
33package object syntax {
44 object all extends AllSyntax
5+ object applicative extends ApplicativeSyntax
56 object apply extends ApplySyntax
67 object bifunctor extends BifunctorSyntax
78 object bifoldable extends BifoldableSyntax
Original file line number Diff line number Diff line change @@ -201,4 +201,12 @@ class SyntaxTests extends AllInstances with AllSyntax {
201201 val g2 = mock[B => D ]
202202 val d0 = fab.bifoldMap(f2, g2)
203203 }
204+
205+ def testApplicative [F [_]: Applicative , A ]: Unit = {
206+ val a = mock[A ]
207+ val fa = a.pure[F ]
208+
209+ val la = mock[Eval [A ]]
210+ val lfa = la.pureEval[F ]
211+ }
204212}
You can’t perform that action at this time.
0 commit comments