raulraja
01/12/2018, 7:49 PMpure fun x(): Int = 0 //compiles
pure fun y(): Int {
println("boom!")
return 1
} //does not compile because `println` is an effect.
pure fun z(): () -> Int = {
effect { println("boom!") }
0
} // compiles because the effect is controled by a function
val effectFun(): () -> Int = z()
run { effectFun() } //runs and compiles because of explicitness
effectFun() //fails to compile because had an effect tag and it's not being explicitly executed.