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

Add Equal contract to the stdlib #1203

Merged
merged 3 commits into from
Mar 28, 2023
Merged

Add Equal contract to the stdlib #1203

merged 3 commits into from
Mar 28, 2023

Conversation

yannham
Copy link
Member

@yannham yannham commented Mar 27, 2023

Following #935, and #1199 (comment) (meaning this PR is required before tackling #1187), this PR introduces an Equal contract to the stdlib, which simply checks that the tested value equals to some constant provided as a parameter to the contract. The Equal contract should preserve laziness over arrays and records.

As per #1199 (comment) and the following comment, this is probably required to fix #1187. This PR doesn't deal with records lazily yet, as it might require a new primop to properly preserve recursiveness (if we use record.map, then we're going to kill recursive references, which is not expected from contracts). This is planned as an immediate follow-up, but this chunk is already reviewable and functional.

@github-actions github-actions bot temporarily deployed to pull request March 27, 2023 14:18 Inactive
Add an Equal contract to the stdlib, which checks that the value is
equal to some constant. This contracts try to preserve laziness, in that
checks are delayed for arrays and records in principle. Caution:
currently, the lazy check isn't implemented for record, so this contract
is actually just `fun c => from_predicate ((==) c)` when `c` is a
record, temporarily.
@github-actions github-actions bot temporarily deployed to pull request March 27, 2023 15:36 Inactive
Copy link
Contributor

@vkleen vkleen left a comment

Choose a reason for hiding this comment

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

👍 I just found some typos.

stdlib/contract.ncl Outdated Show resolved Hide resolved
stdlib/internals.ncl Outdated Show resolved Hide resolved
stdlib/record.ncl Outdated Show resolved Hide resolved
Fix typos in the code documentation

Co-authored-by: Viktor Kleen <[email protected]>
@github-actions github-actions bot temporarily deployed to pull request March 28, 2023 08:45 Inactive
@yannham yannham merged commit da3de2d into master Mar 28, 2023
@yannham yannham deleted the feature/equal-contract branch March 28, 2023 08:52
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.

Merge is not idempotent
2 participants