error bad-main
fn main не принимает параметров и возвращает () или () | E (§2.4).
What it means#
fn main() is the entry point of the program: the runtime starts it as the startup task without arguments (§2.4). The Standard allows two forms only: fn main() and fn main() -> () | E, where every E is an error type (an error from main ends the process with code 1). Effects are not restricted. Parameters, generic parameters and a result with a value (-> i32, -> str | IoError, fn main() => 42) are reported.
Example#
fn main(args: List<str>) io { // <- bad-main
print("{args.len()} arguments")
}error
bad-main
How to fix#
fn main() io {
let args = std.os.args()
print("{args.len()} arguments")
}Read the command line with std.os.args() and the environment with std.os.env(name). To report a failure, return an error (fn main() -> () | Usage) instead of an exit code; to show a result, print it.