Skip to content

Conversation

@StefMa
Copy link
Collaborator

@StefMa StefMa commented Dec 22, 2025

Basically just a convenient function for result.zipWith(result2).
Its just looks better imho 🤷

Result.zip(
  first = getSomeData(),
  second = getOtherData(),
) { a, b -> 
 // TODO
}

// VS

getSomeData().zipWith(getOtherData) { a,b -> 
  // TODO
}

Its getting even more crazy if you have longer names and need line breaks:

        val result = getCurrentlyValidUserTicketingVouchersAction().zipWith(
            getProcessingUserTicketingVouchersAction(),
        ) { activeVouchers, processingVouchers ->
            activeVouchers to processingVouchers
        }

// OR 

        val result = getCurrentlyValidUserTicketingVouchersAction()
            .zipWith(getProcessingUserTicketingVouchersAction()) { activeVouchers, processingVouchers ->
                activeVouchers to processingVouchers
            }

Beside that, I added a few tests for the zipper...

Copy link

@kip-ioki kip-ioki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a purely aesthetic choice, I also like how neat it is to read, better than the zipWith 🎉

@StefMa StefMa requested a review from kip-ioki January 6, 2026 08:58
Copy link

@kip-ioki kip-ioki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm (just one more nit) 🚀

@StefMa StefMa merged commit 59e9fce into main Jan 6, 2026
10 checks passed
@StefMa StefMa deleted the two-result-zip branch January 6, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants