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 support for limited higher-order builtins #6587

Open
effectfully opened this issue Oct 21, 2024 · 0 comments
Open

Add support for limited higher-order builtins #6587

effectfully opened this issue Oct 21, 2024 · 0 comments
Labels

Comments

@effectfully
Copy link
Contributor

#6563 proposes to add support for true higher-order builtins, however not only do we not seem to need that, it is also really complex and very inefficient in the general case. This issue proposes a different approach.

What we can do is add builtins that can call other builtins, as opposed to general UPLC functions. Consider unionValue: in its current form we could express it as

unionValue = unionWith (unionWith (+))

but if we make unionWith a builtin that can take other builtins (that can take other builtins...), then this whole expression is just a single builtin call doing a builtin call (doing a builtin call...), i.e. really efficient.

It seems like this is implementable in UPLC (note however that we probably want to be able to handle arbitrary partially applied builtins as arguments to other builtins), assigning such builtins a reasonable non-parametricity-breaking type is gonna be quite a challenge though.

But this is worth an experiment at least, given how much that would speed everything up and increase the expressive power of the builtins machinery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant