You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, Maybe.compose() requires a Function<? super Maybe<T>, ? extends MaybeSource<R>> and Single.compose() requires something similar
While other types have FlowableTransformer and CompletableTransformer. Would it make sense to bring them into the same pattern? Aside from consistency, early testing for me shows that the generics gymnastics involved in Maybe and Single's Function approaches is a major headache, as any parameterized stream type gets lost and requires manual specification, forfeiting the ability to reuse APIs.
Consider RxLifecycle, which historically has just returned an implementation of the required Transformer.
This works for simple unparameterized types, but breaks down when parameterized types come in.
// Same result with both Single and Maybe. Screenshot is Maybe, example below is Single.// The type is now a List<T> of some type TsomeListSingle
.compose(Confine.to(this).forSingle()) // Compiler error because R type instance not found
.subscribe();
Where Confine.to returns a bridging helper like this:
Currently,
Maybe.compose()
requires aFunction<? super Maybe<T>, ? extends MaybeSource<R>>
andSingle.compose()
requires something similarWhile other types have
FlowableTransformer
andCompletableTransformer
. Would it make sense to bring them into the same pattern? Aside from consistency, early testing for me shows that the generics gymnastics involved inMaybe
andSingle
'sFunction
approaches is a major headache, as any parameterized stream type gets lost and requires manual specification, forfeiting the ability to reuse APIs.Consider RxLifecycle, which historically has just returned an implementation of the required Transformer.
This works for simple unparameterized types, but breaks down when parameterized types come in.
Where
Confine.to
returns a bridging helper like this:FlowableTransformer
andCompletableTransformer
work fine, but the other two have been really tricky to nail down.The text was updated successfully, but these errors were encountered: