FunctionalRx2
FunctionalRx2 is a collection of constructs to simplify a functional programming approach to development on Java and Android.
For the RxJava 1.X version please go to FunctionalRx.
Rationale
The base Java 7 framework does not contain most constructs to do even the simplest functional development. Given that functional programming is a paradigm that's not limited by languages, a series of libraries have been created to bridge some of the gap to others like Kotlin, Scala or Clojure.
FunctionalRx uses RxJava as a backend for their functions and helpers. It's meant to be used in combination with their rective streams.
Usage
An overview of the libraries can be read at Building a Functional Toolset on Android on my blog. If you want to see them in action, watch my presentation on Fully Reactive Apps or visit the FunctionalAndroidReference sample project.
A thorough description and examples of each construct can be found in the readme of their repositories:
RxTuples2 - Simple tuples to use with RxJava
RxSealedUnions2 - Tagged Unions for the RxJava aesthete
RxComprehensions - Reduce boilerplate in RxJava by abstracting chained flatMaps, concatMaps and switchMaps
RxPartialApplication2 - Simple partial application for FunctionN and ConsumerN on RxJava
RxCurrying2 - Simple currying for FuncN and ActionN on RxJava
RxConsumers - Simple ConsumerN composition to use with RxJava
RxFunctions2 - Advanced Function composition to use with RxJava
RxMemoization2 - Simple Function result caching for RxJava
Distribution
Each library can be added individually, or as a group by adding FunctionalRx2.
Add as a dependency to your build.gradle
repositories {
...
maven {
url "https://jitpack.io"
}
...
}
dependencies {
...
compile 'com.github.pakoito:FunctionalRx2:1.1.0'
// This version includes:
// compile 'com.github.pakoito:RxTuples2:1.0.0'
// compile 'com.github.pakoito:RxSealedUnions2:1.0.0'
// compile 'com.github.pakoito.RxComprehensions:rxcomprehensions2:1.3.0'
// compile 'com.github.pakoito:RxMemoization2:1.0.0'
// compile 'com.github.pakoito:RxPartialApplication2:1.0.0'
// compile 'com.github.pakoito:RxCurrying2:1.0.0'
// compile 'com.github.pakoito:RxFunctions2:1.0.0'
// compile 'com.github.pakoito:RxConsumers:1.0.0'
...
}
or to your pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository> </repositories> <dependency>
<groupId>com.github.pakoito</groupId>
<artifactId>FunctionalRx2</artifactId>
<version>1.1.0</version> </dependency>
License
Copyright (c) pakoito 2017
The Apache Software License, Version 2.0
See LICENSE.md