defis not an expression
val x = def ...?
() => Ais a good candidate?
defis enough to ensure referential transparency, which it isn't
def + by nameis, and in that model
valis the equivalent of
IO[A] = () => A, which has the limitations outlined above
def t: Awith
val t: () => A)
Idand in code using
IO, and see how they differ (because the latter takes great care to satisfy various laws under a broad range of operational conditions, and the former doesn't).
Here there are a few implementations of
IO, the first one of which is essentially with
() => A. But I do think that looking at the implementation is not the right way to understand
IO at first