ivanmorgillo
05/07/2020, 2:40 PMsuspend fun loadInt(key: String): Int?
The null
is representing the absence of the value and that's why I was thinking about Either
or Option
, but then there is that problem.
How would you imagine a migration to IO
?
Something like this would work?
fun loadInt(key: String): IO<Int>
simon.vergauwen
05/07/2020, 2:43 PMIO<None, A>
could be a non wrapped version of suspend () -> A?
where you can capture it as such and run it to A?
as a suspend function.ivanmorgillo
05/07/2020, 2:52 PMsimon.vergauwen
05/07/2020, 2:55 PMOption<A> = None | Some<A>
, or Option<A>
is modelled by a object marker None
that short-circuits and a marker for A
that is biased.
IO<E, A>
can model suspend () -> Option<A>
with a object marker None
(IO.Error<None>
)that short-circuits and a marker for A
that is biased (IO.Just
)simon.vergauwen
05/07/2020, 2:56 PMA?
safely into IO
and run it later back to A?
without additional wrapping in IO
.