2.2.0
Fallible Operations (try*)
Fallible collection operations now use a try prefix, inspired by Gleam's naming convention and mirroring stdlib's collection API more closely. Several new operations have also been added.
- Rename
mapResult*functions totryMap*,mapAlltotryMap,fold/foldRighttotryFold/tryFoldRight(d052cf5)- The previous names are deprecated with
@Deprecated+ReplaceWithfor easy migration
- The previous names are deprecated with
- Add
tryFind,tryFindLast,tryForEach,tryForEachIndexed,tryReduce,tryReduceIndexedforIterable(d2011f0) - Add
tryFilter,tryAssociate,tryFlatMap,tryGroupBy,tryPartition+ variants forIterable(f32985e)
Flow Extensions
The kotlin-result-coroutines module now includes extensions for the kotlinx-coroutines Flow type, bringing the same Result-aware operations available on Iterable to asynchronous streams. This was born out of the discussion in #78.
- Add
Flowextensions forkotlin-coroutines(15d44a0)- Factory:
Result<Flow<V>, E>.toFlow() - Flow:
filterOk,filterErr,onEachOk,onEachErr,allOk,allErr,anyOk,anyErr,countOk,countErr,partition,combine,combineErr - Try:
tryFilter,tryFilterNot,tryMap,tryMapNotNull,tryFlatMap,tryForEach,tryReduce,tryFold,tryFind,tryFindLast,tryAssociate,tryAssociateBy,tryAssociateWith,tryGroupBy,tryPartition
- Factory:
Other
- Rename
onSuccess/onFailuretoonOk/onErr(a7c66c0)- The new indexed variants (
onEachOkIndexed,onEachErrIndexed) proved that theSuccess/Failurenaming becomes too verbose.Ok/Erris more readable.
- The new indexed variants (
- Rename
filterValues/filterErrorstofilterOk/filterErr(87f4c36)- Aligns naming with existing
allOk/allErr/anyOk/anyErr/countOk/countErrconventions
- Aligns naming with existing
- Add
onEachOk,onEachOkIndexed,onEachErr,onEachErrIndexedforIterable<Result>(a7c66c0) - Add
combineErrandcombineTo/combineErrToforIterable<Result>(1133e00, c06eeb3) - Propagate nested
coroutineBindingfailures by @dbottillo (d952b52) - Make
BindingExceptionpublic (549ed30)- Fixes
'internal' type accessed from public inline declarationwarning that will become an error in Kotlin 2.4
- Fixes
- Update Kotlin to 2.3.10 (12ceff7)
- Update Gradle to 9.4.0 (468b1a5)