-
Notifications
You must be signed in to change notification settings - Fork 26
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
Why are missing free variables not detected at compile time? #89
Comments
Actually, |
I had to do partialApply :: Program
partialApply = mconcat
[ Stg.add
, [program|
main = \ => let one = \ -> Int# 1#
in let plus1 = \(one) x -> add x one
in plus1 one
|]] This seems to be a consequence of "Like letrec, but the bindings cannot refer to each other (or themselves). In other words, let is non-recursive." (from the README). But shouldn't this be enforced at compile time? |
For two reasons,
As for how to write your program, I would use a add = ... -- Prelude
main = \ =>
letrec
one = \ -> Int# 1#;
plus1 = \(one) x -> add x one
in plus1 one I’ve tried building some better static analysis a couple of times, but it’s not as trivial as I initially thought. I have a long-standing ticket open for reporting unused globals, #23, and a branch that works on that issue ( |
Thanks, I like your |
Is there anything else I can help you with? Otherwise I’ll close the ticket. |
That's fine. You can close this one if you like. |
I tried the following program:
It compiled and ran, ending with
I should have written
Why was this not detected at compile time?
The text was updated successfully, but these errors were encountered: