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

Adding type synonyms to DAML-LF #3616

Closed
cocreature opened this issue Nov 25, 2019 · 2 comments
Closed

Adding type synonyms to DAML-LF #3616

cocreature opened this issue Nov 25, 2019 · 2 comments
Labels

Comments

@cocreature
Copy link
Contributor

As part of our plan to fix cross-SDK dependencies (see #3606), we want to translate DAML typeclass to DAML-LF’s tuples (i.e. structural records). This poses a problem at the use site of a typeclass where we do not have access to the definition of a typeclass but only to its name. Therefore we cannot easily construct the structural record type during the conversion.

To sidestep this issue, we would like to extend DAML-LF with type synonyms of the form

synonym Name a b c = SomeTypeOverabc

This should also allow us to speed up typechecking of structural records a bit (which is going to become important once we start using it for typeclasses) since we can shortcircuit if we get the same synonym.

For the typechecker the type synonym and its definition are always interchangeable. Over the Ledger API, we always expand the type synonym. The interface reader will also always expand type synonyms.

cc @gerolf-da @remyhaemmerle-da @hurryabit @associahedron

@remyhaemmerle-da
Copy link
Collaborator

We agreed with @moritzkiefer-da that type synonyms cannot appear in the types used in type_rep and to_any.

@sofiafaro-da
Copy link
Contributor

Closing this issue as resolved.

sofiafaro-da added a commit that referenced this issue May 18, 2021
Part of #3616

changelog_begin
changelog_end
sofiafaro-da added a commit that referenced this issue May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants