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

Tracking issue for fixing upgrading and cross-SDK deps in DAML #3606

Closed
10 tasks done
cocreature opened this issue Nov 25, 2019 · 3 comments
Closed
10 tasks done

Tracking issue for fixing upgrading and cross-SDK deps in DAML #3606

cocreature opened this issue Nov 25, 2019 · 3 comments
Assignees
Labels
language/now Language team priority NOW language Language team work

Comments

@cocreature
Copy link
Contributor

cocreature commented Nov 25, 2019

  • Forbid generic templates in the DAML preprocessor for now since we haven’t yet figured out to support them with those changes.
  • Desugar typeclasses to structural records in LF. This allows us to combine instances from different SDKs.
  • Move data types from daml-stdlib to separate packages with stable hashes. This makes sure that the hash of things like Either, Tuple2, … doesn’t change. We might want to treat this like a single package for GHC to avoid an explosion of packages.
  • Split up the template typeclass and change Template to a type synonym. This allows us to extend the template typeclass with more methods.
  • Extend LF conversion to handle the new typeclasses.
  • Change template desugaring in our GHC fork to target the new typeclasses.
  • Remove support from LF conversion for the existing syntax.
  • Extend DAML-LF with type synonyms and generate type synonyms for each structural record corresponding to a typeclass.

Next, the changes to handling of data-dependencies (long-term, we might want to remove the separation and treat everything as a data-dependency but I would suggest to do this at the very end if at all).

  • When importing a dependency, we look for typeclass instances in the DALF. We treat everything that has the type corresponding to a type synonym as a typeclass. For each instance, we create a dummy instance. Every reference to the typeclass dictionary will be rewritten to the old dictionary.

  • Adapt daml migrate to a world without generic templates and enable tests for it in the daml assistant integration test suite again.

I’ve probably forgotten some things so feel free to extend this list.

Open Questions

  • Which things to need to be kept intact while we do those changes? I’m somewhat tempted to say that we can break data-dependencies since that isn’t all that useful in the current state and it makes it harder to do the rest incrementally?

  • Do we really need type synonyms? It seems like the only case where we need type synonyms is to figure out which typeclasses exist. Could we instead create a proxy value with the structural record as the type parameter for each typeclass? So for the Ord typeclass we would create something like ord : a -> TypeClassProxy [("compare", a -> a -> Bool)].

    Answering my own question: Yes, we need this so that we know what to translate the TyCon to at the usesite where we do not have access to the typeclass definition (since it can be an AbstractClass for dependencies). Given that we don’t support ConstraintKinds, we probably don’t need to support partial application of the synonym. With constraint kinds, we could end up with class C a b which creates synonym C a b = tuple … and we might have to translate C a.

@hurryabit
Copy link
Contributor

Dropping support for data-dependencies seems reasonable. They aren't particularly useful in the current state of affairs anyway.

@cocreature cocreature added the language Language team work label Feb 5, 2020
@cocreature
Copy link
Contributor Author

The only thing missing here is a new LF release and adapting migrate. I think we probably want to hold off on the latter until we have more experience with writing manual upgrades.

@cocreature
Copy link
Contributor Author

We’ve killed damlc migrate and we’ve released DAML-LF 1.8 so I think this issue has served its purpose. There are still some issues around Generic tracked in #4470

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language/now Language team priority NOW language Language team work
Projects
None yet
Development

No branches or pull requests

3 participants