Effect declarations should be allowed anywhere in a module
Darya- opened this issue · 1 comments
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
.
To reproduce this issue, one could add the following line of code to the textEditor
module (textEditor.wyv
) after the fs
field is defined:
effect Test = {fs.Read}