Satyam Agarwal
04/02/2020, 5:22 AMOption
I been doing IO.just(value).raiseIfNull { MyError }
.
But I found that in some place i did IO { value }.raiseIfNull { MyError }
. They both work. But I am wondering if IO { value }
which is equal to IO.invoke { value }
is costlier than IO.just(value)
. In my head it sound like yes, it should be costlier, because we know the value is pure so just
should not do anything to validate that, and just
is Pure(value)
which is a data class that extends IO<A>()
.
So the question, is what I am thinking is true and using just
and invoke
interchangeably a bad idea ?stojan
04/02/2020, 8:08 AMIO { pureValue }
is not that bad
however using IO.just(println(Hello world))
is bad, because it not pure, will be immediately executed. IO {println("Hello world")}
is pure, because it will be lazily executed, later.
just
is the constructor for creating an IO from a pure valueSatyam Agarwal
04/02/2020, 8:16 AMaballano
04/07/2020, 9:30 AMaballano
04/07/2020, 9:31 AMjust
is that you could try to call a function with it and get an exception, which would crash your app, that’s why there’s a lazy version of itSatyam Agarwal
04/07/2020, 9:31 AMstojan
04/07/2020, 11:22 AMSatyam Agarwal
04/07/2020, 12:13 PMraulraja
04/07/2020, 12:14 PMraulraja
04/07/2020, 12:15 PMraulraja
04/07/2020, 12:16 PMraulraja
04/07/2020, 12:17 PMSatyam Agarwal
04/07/2020, 3:39 PMthat means MonadThrow or any ApplicativeError parametric to Throwable are not correct because you would need MonadDefer and up. This can also help us solve many issues we have with BracketAlso, 1. How can one opt in for not
fillInStackTrace
? Because I get huge stack traces fro arrow when I log them, they are nice, but kibana doesn’t get happy.
2. What are the problems that arises with bracket because of this ?raulraja
04/07/2020, 4:11 PMraulraja
04/07/2020, 4:12 PMraulraja
04/07/2020, 4:12 PM