Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lenguyenthanh/rxarrow
RxJava extensions for Arrow's Data Types
https://github.com/lenguyenthanh/rxarrow
arrow arrow-kt functional-programming kotlin reactive-programming rxjava rxjava2
Last synced: about 1 month ago
JSON representation
RxJava extensions for Arrow's Data Types
- Host: GitHub
- URL: https://github.com/lenguyenthanh/rxarrow
- Owner: lenguyenthanh
- License: apache-2.0
- Created: 2019-08-11T19:26:51.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-24T11:58:05.000Z (over 3 years ago)
- Last Synced: 2023-02-26T23:02:41.205Z (over 1 year ago)
- Topics: arrow, arrow-kt, functional-programming, kotlin, reactive-programming, rxjava, rxjava2
- Language: Kotlin
- Size: 172 KB
- Stars: 16
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RxArrow [![](https://jitpack.io/v/lenguyenthanh/RxArrow.svg)](https://jitpack.io/#lenguyenthanh/RxArrow)
RxArrow is a collection of RxJava extensions and typealiases [Arrow's Data Types](https://arrow-kt.io).
## Table of Contents
+ [Why Z](#z)
+ [Usage](#usage)
+ [Setup](#setup)
+ [Compatibility](#compatibility)
+ [Contributing](#contributing)
+ [License](/LICENSE)I use `Z` as a postfix for all typealiases because I was influenced by [ZIO](https://zio.dev).
### [Observable> aka ObservableZ](https://github.com/lenguyenthanh/RxArrow/blob/master/src/main/kotlin/com/lenguyenthanh/rxarrow/ObservableZ.kt)
`ObservableZ` is a type alias for `Observable>`. It has a convenient extension functions to make life easier when working with `Observable>`.
```Kotlin
Observable.just("error".left(), 23.right()) // Left(error), Right(24): ObservableZ
.mapZ { it + 2 } // Left("error"), Right(25): ObservableZ
.mapLeft { it.reversed() } // Left("rorre"), Right(25): ObservableZ
.mapLeft { SomethingWentWrong } // Left(SomethingWentWrong), Right(25): ObservableZ
.flatMapZ { Observable.just(it * it) } // Left(SomethingWentWrong), Right(625): ObservableZ
.flatMapSingleEither { divide(it, 0) } // Left(SomethingWentWrong), Left(DevidedByZero): ObservableZ
.subscribe { either -> println("$either") }
```### [Single> aka SingleZ](https://github.com/lenguyenthanh/RxArrow/blob/master/src/main/kotlin/com/lenguyenthanh/rxarrow/SingleZ.kt)
Similar to `ObservableZ`
### [Maybe> aka MaybeZ](https://github.com/lenguyenthanh/RxArrow/blob/master/src/main/kotlin/com/lenguyenthanh/rxarrow/MaybeZ.kt)
Similar to `ObservableZ`
You can get `RxArrow` by using [Jitpack](https://jitpack.io/#lenguyenthanh/RxArrow/).
```Gradle
repositories {
jcenter()
maven { url 'https://jitpack.io' }
}implementation "io.arrow-kt:arrow-core:$arrow_version"
implementation "com.github.lenguyenthanh:RxArrow:$rxarrow"
```Supports RxJava2 and Arrow version `0.13.2`.
Any bug reports, feature requests, questions and pull requests are very welcome.