Skip to content
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

Simplify template desugaring #3670

Merged
merged 5 commits into from
Nov 29, 2019
Merged

Conversation

cocreature
Copy link
Contributor

@cocreature cocreature commented Nov 29, 2019

This adapts the LF conversion to the new template desugaring
introduced in our GHC fork. The guiding principle is that we use the
typeclasses directly to avoid generating, typechecking and converting
redundant code caused by indirections. I updated the template
desugaring documentation so that is probably a good starting point for
reviewing this.

See digital-asset/ghc#46 for the corresponding PR to GHC.

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags, if appropriate
  • Normal production system change, include purpose of change in description

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

…emplates

This adapts the LF conversion to the new template desugaring
introduced in our GHC fork. The guiding principle is that we use the
typeclasses directly to avoid generating, typechecking and converting
redundant code caused by indirections. I updated the template
desugaring documentation so that is probably a good starting point for
reviewing this.
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The template desugaring in LFConversion.hs still goes a bit over my head, though.

compiler/damlc/daml-visual/src/DA/Daml/Visual.hs Outdated Show resolved Hide resolved
@@ -123,9 +123,14 @@ extractDocs extractOpts diagsLogger ideOpts fp = do

(adts, md_templateInstances) =
partitionEithers . flip map filteredTyCons $ \adt ->
case getTemplateInstanceDoc adt of
case find (\td -> td_name td == ad_name adt) md_templates of
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@associahedron I’ve hacked around this for now since I don’t want to clutter this PR too much but we should kill the generic templates support from daml-docs in a separate PR.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I can do it if you don't mind.

Copy link
Contributor

@hurryabit hurryabit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing. Thank you so much!

@cocreature cocreature merged commit 75c9b1b into master Nov 29, 2019
@cocreature cocreature deleted the simplify-template-desugaring branch November 29, 2019 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants