Currently, effect declarations are required to appear at the beginning of a module. However, it is useful to have them appear anywhere in the module (just like any other declaration can) because an effect declaration may use a module's field. If an effect isn't declared at the beginning of the module, the compiler throws an error saying that the module definition isn't a subtype of its declarated type. For example, in the text-editor application, if one adds an effect declaration to the TextEditor type and defines that declaration not at the beginning of the textEditor module, the compiler throws an error saying that textEditor isn't a subtype of TextEditor.
Currently, effect declarations are required to appear at the beginning of a module. However, it is useful to have them appear anywhere in the module (just like any other declaration can) because an effect declaration may use a module's field. If an effect isn't declared at the beginning of the module, the compiler throws an error saying that the module definition isn't a subtype of its declarated type. For example, in the text-editor application, if one adds an effect declaration to the
TextEditor
type and defines that declaration not at the beginning of thetextEditor
module, the compiler throws an error saying thattextEditor
isn't a subtype ofTextEditor
.