STG Program to invoke rule 17?

I'm reading the original STG paper https://www.dcc.fc.up.pt/~pbv/aulas/linguagens/peytonjones92implementing.pdf and implementing it along the way. (Raw link to paper: https://www.dcc.fc.up.pt/~pbv/aulas/linguagens/peytonjones92implementing.pdf ) I'm not able to figure out how to invoke rule 17 at all. This rule is to update a function call which calls another function. I've tried creating examples, but all of them wind up invoking the constructor update rule. ╰─$ cat stg-programs/updatable-fn-calls.stg define nu = {} \n {x, y, w, z} -> x {}; define main = {} \n {} -> let x = {} \n {} -> One {}; y = {} \n {} -> Two {}; // closure to update update = {x, y} \u {} -> nu {x, y, y, y}; // have something in argument stack kickstart = {update} \n {a, b} -> update {}; // make sure this is never evaluated bottom = {} \n {} -> bottom {} in case (kickstart {bottom, bottom}) of One {} -> Done {}; This was a program I tried, hoping that the "kickstart" function would ensure that there is something on the argument stack, so that when "nu" is entered, the rule would trigger. However, in my toy STG implementation here (simplexhc link) https://github.com/bollu/simplexhc (Raw: https://github.com/bollu/simplexhc), the rule is not triggered. You can run it with: $ stack build && stack exec simplexhc -- stg-programs/updatable-fn-calls.stg I believe I have either misunderstood the rule or mis-implemented it. So if someone could point me to a reference of how to trigger the rule, I'd be very thankful. I'd like to have some intuition on the rule and "why it works". Cheers, ~ Siddharth -- Sending this from my phone, please excuse any typos!
participants (1)
-
Siddharth Bhat