Fabian
01/20/2020, 3:07 PMmonad-comprehensins
on StateMonad
?
I'm having some code that when implemented with flatMap
s compiles and run without issues BUT with monad-comprehensions throws
java.lang.NoSuchMethodError: arrow.typeclasses.Monad.getFx()Larrow/typeclasses/MonadFx
So I wanted to check for a reference exampleBob Glamm
01/20/2020, 4:15 PMFabian
01/20/2020, 4:30 PMevalOne("1").flatMap(Id.monad()) {
evalOne("2").flatMap(Id.monad()) {
evalOne("+")
}
}.runA(Id.monad(), ListK(emptyList())).value()
This impl does not (throws the exception shown in my previous post)
val result: State<List<Int>, Option<Int>> = State.fx(Id.monad()) {
val (_) = evalOne("1")
val (_) = evalOne("2")
val (c) = evalOne("+")
c
}
result.runA(Id.monad(), ListK(emptyList())).value()
And this is my function
fun evalOne(sym: String): State<List<Int>, Option<Int>> {...}
thanks a lot for any ideas on how to solve thispakoito
01/20/2020, 4:42 PM./gradlew dependencies
and see if you're pulling a consistent version or if gradle resolves to a previous one due to a transitive dependencypakoito
01/20/2020, 4:42 PMFabian
01/20/2020, 4:44 PMpakoito
01/20/2020, 4:46 PM.bind()
or !
instead of destructuringpakoito
01/20/2020, 4:46 PM