play-monadic-actions icon indicating copy to clipboard operation
play-monadic-actions copied to clipboard

Compilation failures with v2.1 to v2.2 upgrade

Open marko-asplund opened this issue 4 years ago • 3 comments

I'm experiencing compilation problems when upgrading from v2.1.0 to v2.2.0. These seem to be related to the addition of fBooleanToStepOps implicit conversion. Could you please provide some context on why the function was added?

I'm getting the following compilation error:

[error] Foo.scala:1:1: overloaded method ?| with alternatives:
[error]   (failureThunk: => play.api.mvc.Result)io.kanaka.monadic.dsl.Step[Unit] <and>
[error]   (failureHandler: Unit => play.api.mvc.Result)io.kanaka.monadic.dsl.Step[Unit]
[error]  cannot be applied to (Throwable => play.api.mvc.Result)
[error]       result   <- myOp()   ?| errorHandler("Failed do smth")
def myOp(): Future[Boolean] = ???
def errorHandler(msg: String): Throwable => Result = ???

I'm using the following import:

import io.kanaka.monadic.dsl.

With version v2.2.0 both futureToStepOps and fBooleanToStepOps can provide the required conversion whereas with v2.1.0 there's only futureToStepOps.

Use of futureToStepOps conversion results in StepOps[A, Throwable] and fBooleanToStepOps in StepOps[Unit, Unit], causing the compilation failure.

The code compiles with v2.2.0 if I e.g. shadow fBooleanToStepOps as follows:

import io.kanaka.monadic.dsl.{fBooleanToStepOps => _, _}

marko-asplund avatar Aug 31 '20 14:08 marko-asplund

can you please provide a full code example that was compiling with 2.1 and breaks with 2.2?

vil1 avatar Sep 08 '20 10:09 vil1

Can you please test again with 2.2.1?

vil1 avatar Oct 22 '20 10:10 vil1

Still getting the same error with the new version:

[error] Foo.scala:1:1: overloaded method value ?| with alternatives:
[error]   (failureThunk: => play.api.mvc.Result)io.kanaka.monadic.dsl.Step[Unit] <and>
[error]   (failureHandler: Unit => play.api.mvc.Result)io.kanaka.monadic.dsl.Step[Unit]
[error]  cannot be applied to (Throwable => play.api.mvc.Result)
[error]       result   <- myOp()   ?| errorHandler("Failed do smth")
[error]                            ^

marko-asplund avatar Oct 22 '20 19:10 marko-asplund