This is more inline also with Arrow and Fx expecting side effects including things that can fail inside suspension or IO
👍 1
j
Joram Visser
09/01/2019, 6:55 AM
Talking about side effects and the above posted snippet. How should I call that parseDate function in an Arrow Fx way? Throwing and catching is not pure. But we can always expect the same result back from the function. Should this be considered an unsafe operation?
r
raulraja
09/01/2019, 12:24 PM
parsing is unsafe and an effect and since it’s suspended you can use this function freely inside anywhere that is also suspended or lifting to IO with IO.effect or
fx { effect { ... } }
.
Copy code
val x: IO<Either<ParseDate, Date>> = IO.effect { "boom".parseDate() }