-
Notifications
You must be signed in to change notification settings - Fork 476
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
Make forcing builtin functions pure and work-free #5627
Conversation
<> dest | ||
where | ||
workFreedom = case dtermInner of | ||
-- Forcing a builtin is workfree |
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.
why?
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.
Forcing builtin functions is currently work-free. I don't know that there's any reason in principle why we couldn't have a builtin with only type arguments. If this is a constraint we should make sure we're checking it somewhere otherwise this could go wrong later.
If it is currently work-free then I think we should do this. The reason I want to do this is because it is needed by CSE. It's a bad idea to consider work-free items like |
Or we could come up with a more precise version. Forcing a builtin is work-free if the builtin does not have a single type argument. You also possibly need to handle repeated forcing. In fact, doesn't the work-free check already look at whether the builtin is saturated, which should subsume this? |
This is already being checked. This is what
No - the additional check I added does this; it isn't done currently. |
Ah, it's behind the PIR one. Seems better to bring it in line with the PIR one, which I think handles all builtin applications correctly? https://github.com/input-output-hk/plutus/blob/master/plutus-core/plutus-ir/src/PlutusIR/Purity.hs#L149 |
Yeah that seems the right thing to do |
Ok, I'll put this down as a good first task for newhires |
and added a test.