aboutsummaryrefslogtreecommitdiff
path: root/examples/26-effect-resume/src/HelloWorld.shed
blob: a5e96e2f3de15a9f996cc6a400a315d04d2e471e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
effect Writer {
    fun hello() -> Unit;
    fun world() -> Unit;
}

pub fun main() ! Io -> Unit {
    try {
        Writer.hello!();
        print!(", ");
        Writer.world!();
        print!("\n");
    } handle Writer {
        fun hello() {
            print!("hello");
            resume;
        }

        fun world() {
            print!("world");
            resume;
        }
    }
}