// A name must denote the kind of thing its position needs. import std/io type Shape { Circle(Int), Square(Int) } effect log { fn log :: msg: String -> () } fn area :: s: Shape -> Int { match s { Circle(r) -> 3 * r * r, Square(side) -> side * side } } // A module, a type or a function where a value or constructor is needed // (E0109). fn module_as_value :: { let printer = io //~ ERROR E0109 `io` is a module, not a value } fn type_as_value :: { let s = Shape //~ ERROR E0109 `Shape` is a type, trait or effect, not a value } fn function_as_pattern :: s: Shape -> Int { match s { io.println(x) -> 0 //~ ERROR E0109 `io.println` is not a constructor } } // A handler clause names an operation (E0112). fn handles_a_function :: -> () { handle { log "hi" } with { log m -> () , area s -> () //~ ERROR E0112 `area` is not an effect operation } }