aol / cyclops-integration

Home of the cyclops integration modules : support for Scala, Clojure, RxJava (1+2), Reactor, FunctionalJava, Guava, Dexx & Vavr
http://cyclops-react.io
MIT License
442 stars 51 forks source link

Incorrect return type parameter for Try.flatten() #258

Closed sgoeminn closed 7 years ago

sgoeminn commented 7 years ago

The following code is expected to compile. However, it returns a Try<Try<String, Throwable>, Throwable>>. Try<String, Throwable> r = Try.of(Try.of("r")).flatten();

Expecting interface to specify a type similar to the return type of flatMap: public <R> Try<R,X> flatten() with two implicit cases:

johnmcclean commented 7 years ago

Hey @sgoeminn, which version are you using? The latest cyclops-react 2.x has a static flatten method that can be used as follows

    Try<String, Throwable> r = Try.of(Try.of("r")).to(Try::flatten);

This is guaranteed to be type-safe. We can backport this to standalone cyclops-try if needed.

sgoeminn commented 7 years ago

@johnmcclean-aol I'm using version 7.2.3 (http://static.javadoc.io/com.aol.cyclops/cyclops-try/7.2.3/com/aol/cyclops/trycatch/Try.html#flatten--)

johnmcclean commented 7 years ago

Released in https://github.com/aol/cyclops/releases/tag/v7.2.4