-
Notifications
You must be signed in to change notification settings - Fork 155
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
Spine-lazy vector functions #2808
Comments
As @kleinreact can attest to, I have real-life code where, due to |
Related: If |
Hmm, I wanted to start working on this but very quickly realized that |
Oh no, that really is too bad. If spine-lazy vector functions are a thing that can work (I really can't gauge its effect on Clash the compiler, which is why I kept quiet in this issue), we should think about whether it's actually worth it to add a (And sometimes you're saved because you have an actual Anyway, you should probably always use |
Functions that construct vectors with a known length should be able to produce the spine fully lazily. For example, I don't think there's a good reason why
map (const 0) (undefined :: Vec 5 ())
should bottom out.So I propose rewriting the vector functions a la the following examples:
(I'm including
zipWith
here to demonstrate how nicely unbiased it becomes with this technique).The text was updated successfully, but these errors were encountered: