effect Log {
    fn log(msg: String): Unit
}

fn computation(): Int with {Log, Random} = {
    Log.log("Starting computation")
    let x = Random.int(1, 10)
    Log.log("Processing value")
    let result = x * 2
    Log.log("Done")
    result
}

handler consoleLog: Log {
    fn log(msg) = Console.print("[LOG] " + msg)
}

fn main(): Unit with {Console} = {
    let result = run computation() with {
    Log = consoleLog,
}
    Console.print("Generated: " + toString(result / 2))
    Console.print("Result: " + toString(result))
}

let output = run main() with {}
