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 a Lazy type that compiles to delay/force #5908

Open
zliu41 opened this issue Apr 16, 2024 · 3 comments · May be fixed by #5910
Open

Add a Lazy type that compiles to delay/force #5908

zliu41 opened this issue Apr 16, 2024 · 3 comments · May be fixed by #5910

Comments

@zliu41
Copy link
Member

zliu41 commented Apr 16, 2024

Describe the feature you'd like

See this comment from Roman: https://github.com/IntersectMBO/plutus/pull/5901/files#r1563932610

Describe alternatives you've considered

No response

@michaelpj
Copy link
Contributor

I think this can be done with some simple library code:

newtype Lazy a = Lazy (forall b . a)

force :: Lazy a -> a
force (Lazy a) = a @()

@michaelpj
Copy link
Contributor

And I'd prefer if we called it Delay rather than Lazy, since it's not lazy in the sense of Haskell since it's not memoized.

@michaelpj
Copy link
Contributor

Probably the type instantiation should be at a builtin type, so we don't hold on to the unit type definition if we don't need it.

michaelpj added a commit that referenced this issue Apr 17, 2024
Fixes #5908.

Unsure where to put this, it could go in its own module I guess.
@michaelpj michaelpj linked a pull request Apr 17, 2024 that will close this issue
@Unisay Unisay added status: triaged Internal and removed status: needs triage GH issues that requires triage labels Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants