-
Notifications
You must be signed in to change notification settings - Fork 502
Docs for casing on constants #7481
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
base: master
Are you sure you want to change the base?
Conversation
|
|
The doc seems useful! I propose to add Plinth examples to accompany UPLC examples, as this user guide is for Plinth and it makes sense to showcase its types/expressions too. |
zliu41
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our convention for docs is to put each sentence on one line. No need to update this one but please keep it in mind in the future.
|
|
||
| ::: | ||
|
|
||
| In UPLC, it is possible to branch on expressions of certain built-in types, like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should mention other ways of deconstructing builtin types (e.g., for bool one can use ifThenElse), and why using the new builtin casing feature is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some :::info about this to most of the types, please check if my understanding is correct here.
| lam x (case x (lam a (lam b [(builtin addInteger) a b]))) | ||
| ``` | ||
|
|
||
| ### Integer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mention that the datatypes=BuiltinCasing optoin is irrelevant to Integer. To take advantage of casing on integer, in Plinth one must use PlutusTx.Builtins.caseInteger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the implementation, I think the BuiltinCasing option is necessary. Otherwise it compiles into !!.
No description provided.