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

Remove version tag from encoded expressions #805

Merged
merged 8 commits into from
Feb 4, 2019

Conversation

Gabriella439
Copy link
Collaborator

... as standardized in dhall-lang/dhall-lang#362

dhall/src/Dhall/Binary.hs Outdated Show resolved Hide resolved
@f-f
Copy link
Member

f-f commented Jan 31, 2019

@Gabriel439 I felt there was a more beautiful way to write that :)

Now the CBOR decoding from cache goes fine, but in case you're importing a hash-protected expression, and the hash has been generated by a previous implementation, then there's a HashMismatch happening.
I think it's thrown here because the hash of the term given by the new encode doesn't match the hash in the file (as the CBOR terms are different).

The last bit of backwards-compat could be another alternative here where instead of only one actualHash, we have an alternative in which we try to hashExpression (that calls the new Dhall.Binary.encode), and to hashExpressionLegacy (that would call a Dhall.Binary.encodeLegacy, which would wrap the term with the version in the same way we do currently on master) for every past standard version (or the last one, or the last two, etc), so that there would be at least one hash that matches.

dhall/src/Dhall/Import.hs Outdated Show resolved Hide resolved
dhall/src/Dhall/Import.hs Outdated Show resolved Hide resolved
@f-f
Copy link
Member

f-f commented Jan 31, 2019

@Gabriel439 I tested this branch locally with spago and it works nicely. Very many thanks! 😊

@Gabriella439
Copy link
Collaborator Author

@f-f: You're welcome! Don't forget to review the corresponding change to the standard 🙂

@Gabriella439 Gabriella439 merged commit 04ec458 into master Feb 4, 2019
@Gabriella439 Gabriella439 deleted the gabriel/no_version_tag branch February 4, 2019 05:17
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.

None yet

3 participants