Use generic identifiers from kotlin stdlib for zip functions
This commit is contained in:
parent
65b9065164
commit
7e6f4d1104
@ -8,11 +8,11 @@ private typealias Producer<T, E> = () -> Result<T, E>
|
|||||||
*
|
*
|
||||||
* - Elm: http://package.elm-lang.org/packages/elm-lang/core/latest/Result#map2
|
* - Elm: http://package.elm-lang.org/packages/elm-lang/core/latest/Result#map2
|
||||||
*/
|
*/
|
||||||
inline fun <V1, V2, E, U> zip(
|
inline fun <T1, T2, E, V> zip(
|
||||||
result1: Producer<V1, E>,
|
result1: Producer<T1, E>,
|
||||||
result2: Producer<V2, E>,
|
result2: Producer<T2, E>,
|
||||||
transform: (V1, V2) -> U
|
transform: (T1, T2) -> V
|
||||||
): Result<U, E> {
|
): Result<V, E> {
|
||||||
return result1().flatMap { v1 ->
|
return result1().flatMap { v1 ->
|
||||||
result2().map { v2 ->
|
result2().map { v2 ->
|
||||||
transform(v1, v2)
|
transform(v1, v2)
|
||||||
@ -26,12 +26,12 @@ inline fun <V1, V2, E, U> zip(
|
|||||||
*
|
*
|
||||||
* - Elm: http://package.elm-lang.org/packages/elm-lang/core/latest/Result#map3
|
* - Elm: http://package.elm-lang.org/packages/elm-lang/core/latest/Result#map3
|
||||||
*/
|
*/
|
||||||
inline fun <V1, V2, V3, E, U> zip(
|
inline fun <T1, T2, T3, E, V> zip(
|
||||||
result1: Producer<V1, E>,
|
result1: Producer<T1, E>,
|
||||||
result2: Producer<V2, E>,
|
result2: Producer<T2, E>,
|
||||||
result3: Producer<V3, E>,
|
result3: Producer<T3, E>,
|
||||||
transform: (V1, V2, V3) -> U
|
transform: (T1, T2, T3) -> V
|
||||||
): Result<U, E> {
|
): Result<V, E> {
|
||||||
return result1().flatMap { v1 ->
|
return result1().flatMap { v1 ->
|
||||||
result2().flatMap { v2 ->
|
result2().flatMap { v2 ->
|
||||||
result3().map { v3 ->
|
result3().map { v3 ->
|
||||||
@ -47,13 +47,13 @@ inline fun <V1, V2, V3, E, U> zip(
|
|||||||
*
|
*
|
||||||
* - Elm: http://package.elm-lang.org/packages/elm-lang/core/latest/Result#map4
|
* - Elm: http://package.elm-lang.org/packages/elm-lang/core/latest/Result#map4
|
||||||
*/
|
*/
|
||||||
inline fun <V1, V2, V3, V4, E, U> zip(
|
inline fun <T1, T2, T3, T4, E, V> zip(
|
||||||
result1: Producer<V1, E>,
|
result1: Producer<T1, E>,
|
||||||
result2: Producer<V2, E>,
|
result2: Producer<T2, E>,
|
||||||
result3: Producer<V3, E>,
|
result3: Producer<T3, E>,
|
||||||
result4: Producer<V4, E>,
|
result4: Producer<T4, E>,
|
||||||
transform: (V1, V2, V3, V4) -> U
|
transform: (T1, T2, T3, T4) -> V
|
||||||
): Result<U, E> {
|
): Result<V, E> {
|
||||||
return result1().flatMap { v1 ->
|
return result1().flatMap { v1 ->
|
||||||
result2().flatMap { v2 ->
|
result2().flatMap { v2 ->
|
||||||
result3().flatMap { v3 ->
|
result3().flatMap { v3 ->
|
||||||
@ -71,14 +71,14 @@ inline fun <V1, V2, V3, V4, E, U> zip(
|
|||||||
*
|
*
|
||||||
* - Elm: http://package.elm-lang.org/packages/elm-lang/core/latest/Result#map5
|
* - Elm: http://package.elm-lang.org/packages/elm-lang/core/latest/Result#map5
|
||||||
*/
|
*/
|
||||||
inline fun <V1, V2, V3, V4, V5, E, U> zip(
|
inline fun <T1, T2, T3, T4, T5, E, V> zip(
|
||||||
result1: Producer<V1, E>,
|
result1: Producer<T1, E>,
|
||||||
result2: Producer<V2, E>,
|
result2: Producer<T2, E>,
|
||||||
result3: Producer<V3, E>,
|
result3: Producer<T3, E>,
|
||||||
result4: Producer<V4, E>,
|
result4: Producer<T4, E>,
|
||||||
result5: Producer<V5, E>,
|
result5: Producer<T5, E>,
|
||||||
transform: (V1, V2, V3, V4, V5) -> U
|
transform: (T1, T2, T3, T4, T5) -> V
|
||||||
): Result<U, E> {
|
): Result<V, E> {
|
||||||
return result1().flatMap { v1 ->
|
return result1().flatMap { v1 ->
|
||||||
result2().flatMap { v2 ->
|
result2().flatMap { v2 ->
|
||||||
result3().flatMap { v3 ->
|
result3().flatMap { v3 ->
|
||||||
|
Loading…
Reference in New Issue
Block a user