-
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
LF conversion of templates under new rules (WIP). #4030
Conversation
compiler/damlc/daml-lf-conversion/src/DA/Daml/LFConversion/Primitives.hs
Outdated
Show resolved
Hide resolved
@@ -91,6 +91,7 @@ importDamlPreprocessor = fmap onModule | |||
where | |||
onModule y = y { | |||
GHC.hsmodImports = | |||
newImport True "GHC.Types" : |
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.
To add some context this is because the template desugaring from digital-asset/ghc#47 uses primitive
.
compiler/damlc/daml-stdlib-src/DA/Internal/Template/Functions.daml
Outdated
Show resolved
Hide resolved
compiler/damlc/tests/daml-test-files/NewTemplateDesugaring.daml
Outdated
Show resolved
Hide resolved
compiler/damlc/daml-lf-conversion/src/DA/Daml/LFConversion/Primitives.hs
Outdated
Show resolved
Hide resolved
) | ||
) | ||
|
||
pattern HasSignatoryDFunId, HasEnsureDFunId, HasAgreementDFunId, HasObserverDFunId |
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.
Much nicer than the silly name matching that I did before, thanks!
| Just internals <- lookupUFM internalFunctions (envGHCModuleName env) | ||
, getOccFS name `elementOfUniqSet` internals | ||
= pure [] | ||
-- NOTE(MH): Desugaring `template X` will result in a type class |
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 guess this is no longer necessary since we don’t have any default implementations?
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.
Right, and we don't want to filter out the $c
methods either. We don't actually want templates to be special in any way with respect to GHC's & damlc's handling of typeclasses.
The generation of Template instances will break horribly with #4030 and we don’t actually want to use this anymore since we want to reuse old class instances. There are some cases where we might still need or want this in the future (see the inline comment), so for now, the code for this is still left intact and only disabled. changelog_begin changelog_end
/AzurePipelines run |
Pull request contains merge conflicts. |
The generation of Template instances will break horribly with #4030 and we don’t actually want to use this anymore since we want to reuse old class instances. There are some cases where we might still need or want this in the future (see the inline comment), so for now, the code for this is still left intact and only disabled. changelog_begin changelog_end
changelog_begin changelog_end
I tested the new damlc against a large existing repo and it built without problem. Only thing missing is to replace the ghc-lib reference with a new release. |
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.
Awesome, thank you so much for doing this! I’ll update the ghc-lib URL once the PR has gone through.
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.
Very nice. Thank you so much.
I've focused on the changes to the stdlib and they look good to me. I trust the combined forces of you, @cocreature and our tests that the changes to the conversion are good too.
No description provided.