Hi, <@U0RM4EPC7>. Thanks for your <blog post> on ...
# arrow
j
Hi, @simon.vergauwen. Thanks for your blog post on
Effect
. It all made sense to me, except for this:
Only when
fold
is called it will create a
Continuation
and run the computation, this means
Effect
can encode
side-effects
as
pure values
.
What does pure values mean? I know what a pure function is, but I don't think I've ever come across pure values.
s
Oh, that refers to the fact you can safely assign an impure function to a value in a pure way. For example:
Copy code
fun error(): Nothing = TODO()

val impure: String = error()
val pure: Effect<Nothing, String> = effect {
  error()
}
s
aren't both those compile errors? 🤔
s
fun error()
shouldn't have
suspend
in my example. Updated it
👍 2
Now it compiles
j
Thanks!