Skip to content

Interoperability

johnmcclean-aol edited this page Nov 23, 2016 · 4 revisions

Interoperability

Maximizing interoperability of cyclops across the broad Java 8 eco-system and the JDK is a key component, essential to meeting the project's core goal.

## Java 8 eco-system

Java 8 eco-system

Interop via Iterable

Very many Java classes implement Iterable (not only JDK collections but also Javaslang and Functional Java collections / value types). By both implementing Iterable on our own types and accepting Iterables as inputs within our APIs we maximize interoperability with libraries that also make use of Iterable.

Interop via Publisher

The Reactive Streams API defines a standard for interoperability between data producers and data consumers. By implementing Reactive Streams Publishers across our types we ensure that libraries such as Pivotal's Reactor and RxJava 2 can reuse them out of the box. Likewise we can further maximize interoperability by accepting Publishers within our APIs too.

AnyM

AnyM is a mechanism whereby we can abstract over any Java Functor and Monad types, this is done by writing once only, if neccessary, an Adapter that help cyclops execute the appropriate map and flatMap methods.

Higher Kinded Types

The encoding of Derive4j HKTs allows cyclops-react to accept 3rd party types encoded in such a manner into it's APIs in way that maintains full type information.

Recommended libaries

Lombok, Derive4j and Immutables can significantly reduce boiler plate code in Java - particularly when generating case classes and Algebraic Data Types. Lombok's val also helps with Java's verbosity when working with large generic signatutes.

Further reading

Clone this wiki locally