E4168#
Compiler diagnostic name: error_poly_unsupported.
Error polymorphism is not supported in this position.
The raise? annotation means that a function is error-polymorphic: it can
propagate the error behavior of a callback or another polymorphic operation.
MoonBit only supports this form in specific function positions. It is not a
general-purpose type annotation that can be used anywhere a function type is
written.
Erroneous example#
The following toplevel value uses raise? in a function type annotation:
///|
///|
let _callback : () -> Unit raise? = fn() { () }
MoonBit will report an error.
Suggestion#
Use a non-raising function type when the callback cannot raise, or use an
ordinary concrete raise annotation in a supported function declaration when
the function may raise:
///|
///|
let _callback : () -> Unit = fn() { () }