I believe this one is for the debugger, I've been ...
# arrow
p
I believe this one is for the debugger, I've been able to repro but cannot dig into what happens when
!put("A", 1)
is called. We know it never reaches the interpreter.
p
Copy code
val test = KVStoreA.put("aa", 1)
        .flatMap {KVStoreA.get<Int>("aa")}
        .run(interpreterState, State().monad()).fix()
        .runS (emptyMap<String, Int>())
    println("test -> $test")
test -> {aa=1} So, flatMap works as expected...
Note: my implementation of `KVStoreA.Get<*>`is erroneous...
runA
throws a class cast exception ! but it's an other problem...
p
which version are you in?
0.9 or 0.10-SNAP?
p
0.10
p
weird
can you please check on a debugger where it
it's stuck?
there needs to be some sync await, or somewhere where the thread is stuck waiting
not waiting but...not executing
p
The flatMapped version works with an explicit type:
is KVStoreA.Get<*> -> State().inspect { it  : Map<String, Any?> -> Option.fromNullable(it[op.key]) }
Copy code
val test =KVStoreA.put("aa", 1) 
        .flatMap {KVStoreA.get<Int>("aa")}
        .run(interpreterState, State().monad()).fix()
        .runA(emptyMap<String, Int>())
    println("test -> $test")
gives test -> Some(1) => Each case of the natural transformation should be typed ! The behavior of the compilo is strange 🙃
Tomorrow, i will check the type of
val a = !put("A", 1)
… i've no compilator on hand
p
👍🏼
I did it on try.arrow, they’re
Unit
and
Option<Int>
it has to be something on Free
p
Me too. We get the type of Put transformation (i.e. the first/previous transformation). But, that does not explain why the program is not executed...
Paco, I fixed my GIST 😃 In fact, a
fix()
was missing before the call of
run(initialtstate)
. Thx for your help.
I saw too late that my
run
was not applied on the right object. I will dig to understand the non execution of the program without
fix
p
it was using the scope
run
function from kotlin
not the
run
member function that you expected
how did you find ot?
p
I ended up seeing the braces...
Ok, now to continue my learning of Arrow, I will create instances of
Inject
and try to compose DSL ...
p
We should rename that method TBH
I’ll do it now
p
In any case, I should have noticed that my program did not return a
Tuple2