|
5 | 5 | import java.util.Objects; |
6 | 6 | import java.util.function.Function; |
7 | 7 |
|
| 8 | +import static com.jnape.palatable.lambda.functions.builtin.fn1.Upcast.upcast; |
| 9 | + |
8 | 10 | /** |
9 | 11 | * A functor representing the type-level composition of two {@link Applicative} functors; useful for preserving nested |
10 | 12 | * type-level transformations during traversal of a {@link com.jnape.palatable.lambda.traversable.Traversable}. |
@@ -60,7 +62,16 @@ public <B> Compose<F, G, B> zip(Applicative<Function<? super A, ? extends B>, Co |
60 | 62 | @Override |
61 | 63 | public <B> Lazy<Compose<F, G, B>> lazyZip( |
62 | 64 | Lazy<? extends Applicative<Function<? super A, ? extends B>, Compose<F, G, ?>>> lazyAppFn) { |
63 | | - return Applicative.super.lazyZip(lazyAppFn).fmap(Applicative<B, Compose<F, G, ?>>::coerce); |
| 65 | + @SuppressWarnings("RedundantTypeArguments") |
| 66 | + Lazy<Applicative<Applicative<Function<? super A, ? extends B>, G>, F>> lazyAppFnCoerced = |
| 67 | + lazyAppFn |
| 68 | + .<Compose<F, G, Function<? super A, ? extends B>>>fmap( |
| 69 | + Applicative<Function<? super A, ? extends B>, Compose<F, G, ?>>::coerce) |
| 70 | + .fmap(Compose<F, G, Function<? super A, ? extends B>>::getCompose); |
| 71 | + |
| 72 | + return fga.<Applicative<A, G>>fmap(upcast()) |
| 73 | + .<Applicative<B, G>>lazyZip(lazyAppFnCoerced.fmap(fgf -> fgf.fmap(gf -> ga -> ga.zip(gf)))) |
| 74 | + .fmap(Compose::new); |
64 | 75 | } |
65 | 76 |
|
66 | 77 | /** |
|
0 commit comments