-
Notifications
You must be signed in to change notification settings - Fork 43
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
Generalize Contract
#135
Open
edsko
wants to merge
5
commits into
input-output-hk:master
Choose a base branch
from
edsko:edsko/generalize-contract
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Generalize Contract
#135
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This helps understand the public surface of the `Semantics` module.
This introduces two type parameters `i` and `t` that generalize over the type of identity (`ByteString` in `marlowe`, `PubKeyHash` in `marlowe-cardano`) and token (`Token` by default). Nothing in the language definition actually cares what these two types are. For the main definitions in each module, I've introduced a new "generalized" function (e.g., `computeTransaction'`), and then defined the "old" function (e.g., `computeTransaction`) in terms of that more general one. I have also generalized all the examples; the examples don't care what `i` and `t` are either, _except_ that they often hardcode a choice of `ada` as the token; but this doesn't change the examples at all. So for the examples I've added a separate token type as an additional argument. (The examples always use roles, so they really are polymorphic in `i`.)
Marked this as a draft because we haven't tried to use this yet. Will report back, but can invite feedback in the meanwhile. |
Ok, confirmed that this works for us. Marked as ready for review. Let me know if there is anything you'd like me to change! :) |
Hi Edsko, Thanks for your contribution! We will soon analyze the PR in more detail, but I wanted to share some quick notes:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes three changes:
-Wall
and gives a few modules some export lists. This helped me understand what exactly was the expected interface of these modules. It's possible I should have exported a few more things. (If it's preferred, I can also remove the export lists again now that they served their purpose).Contract
and everything related over the type of identityi
(here, that wasByteString
; inmarlowe-cardano
, that would bePubKeyHash
), and the token of tokenst
(by defaultToken
). See commit message for further detail.This PR comes after an older one against
marlowe-cardano
(input-output-hk/marlowe-cardano#182), along with a comment there from @hrajchert that that work would have been better done against this repo. At the time I thought that would not be an option for us, as we needed the generalization also in the Plutus interpreter, but we have since realized that we can avoid that. Moreover, themarlowe
repo now seems to be in line with themarlowe-cardano
in terms of the language (concretely, merkleization is supported and it usesPOSXTIme
instead of slots). These two things together mean that it might indeed be feasible for us to use this repo instead.