Pedro Silva
09/20/2019, 9:42 AMflatMap implementation to:
override fun <A, B> Kind<ForCompletionStage, A>.flatMap(f: (A) -> Kind<ForCompletionStage, B>): CompletionStage<B> {
val x1: CompletionStageOf<A> = this.fix()
val x2: CompletionStage<A> = x1.fut
val x3: CompletionStage<B> = x2.thenCompose { f(it).fix().fut }
return x3
}
I get the following compiler error:
Return type of 'flatMap' is not a subtype of the return type of the overridden member 'public abstract fun <A, B> Kind<ForCompletionStage, A#1 (type parameter of arrow.typeclasses.Monad.flatMap)>.flatMap(f: (A#1) -> Kind<ForCompletionStage, B#1 (type parameter of arrow.typeclasses.Monad.flatMap)>): Kind<ForCompletionStage, B#1> defined in arrow.typeclasses.Monad'