val result = runBlocking { parse("1") ...
# arrow
r
val result = runBlocking { parse("1") } val resultFx = IO.fx{ !effect{ parse("werew")} // an exception into an effect }.unsafeRunSync()
p
fx
here is redundant btw 😄
IO { parse("werew") }
just works
does the same thing
if you use this approach use
attempt()
to convert it to an either
IO { parse("werew") }.attempt().unsafeRunSync()
👍 1
r
attempt creates another another either, I think then code the should be IO{"eqr".toInt()}.attempt().mapLeft("wrong string value").unsafeRunSync()
p
works for me 🙂
r
paco I think much much earlier I asked a question about STM
was it you who told to come to be on this channel ?
I asked it on gitter
p
what do you want to do with STM? We have
bracket
and
bracketCase
for this
r
i want to do transfer thing
between 2 accounts
how does brackcase help
p
Copy code
bracketCase({ if (it !is Success) rollback() }) {
  remove().flatMap { add() }
}
that’s the pattern
r
ok i wil try to make for a transaction of money betweeen 2 acccounts