-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change placeholder unit viewtypes to empty records #14656
Conversation
006e7dd
to
9795f46
Compare
CHANGELOG_BEGIN CHANGELOG_END
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks.
@@ -7,9 +7,11 @@ module Interface where | |||
|
|||
import DA.Assert ((===)) | |||
|
|||
data EmptyInterfaceView = EmptyInterfaceView |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This declares an enum, not a record, so it should be
data EmptyInterfaceView = EmptyInterfaceView | |
data EmptyInterfaceView = EmptyInterfaceView {} |
You can tell because the desugared version of this declaration has the "stupid theta" GHC.Types.DamlEnum
:
data GHC.Types.DamlEnum => EmptyInterfaceView = EmptyInterfaceView
Tangentially, I had a vague memory of the compiler failing with data
declarations like this one, suggesting to make it explicitly a record with empty braces or explicitly a variant with empty parens. The docs do mention this restriction, but I wasn't able to replicate it even with sdk-version: 1.14.0
- turns out this restriction was removed in 0.13.33 (2019-11-06)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Digging a bit more, that is the reason for the GHC.Types.DamlEnum
stupid theta: it's only used for single-constructor enums to differentiate them from variants and records, while enums with more constructors don't need it, see #3345
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced all using sed -i 's/data EmptyInterfaceView = EmptyInterfaceView/data EmptyInterfaceView = EmptyInterfaceView {}/' $(ag 'data EmptyInterfaceView = EmptyInterfaceView' -l)
, fingers crossed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve the idea behind this PR but to meet the requirement that an interface viewtype must be a record you will need to change the EmptyInterfaceView
data
declarations to make them explicitly records, otherwise the compiler will treat them as enums.
Hopefully it should be enough to search and replace s/(data EmptyInterfaceView = EmptyInterfaceView)/$1 {}/
and then refresh the golden files.
fingers crossed! |
7c78953
to
01252a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good on the documentation end.
No description provided.