<div dir="ltr"><div>Your code turns into (roughly)<br></div><div><br></div><div>module M1 where</div><div> M11.f : (p : ℕ) → ℕ → ℕ</div><div> M11.f p x = p + x</div><div><br></div><div>module M2 where</div><div> f = M1.M11.f 2</div><div> g : ℕ → ℕ</div> g x = f (suc x)<div><div class="gmail_extra"><br></div><div class="gmail_extra">No normalisation takes place.</div><div class="gmail_extra"><br></div><div class="gmail_extra">/ Ulf</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 30, 2017 at 10:20 PM, Sergei Meshveliani <span dir="ltr"><<a href="mailto:mechvel@botik.ru" target="_blank">mechvel@botik.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear Agda developers,<br>
<br>
consider the modules M1.agda and M2.agda of<br>
<br>
------------------------------<wbr>---------<br>
module M1 where<br>
open import Data.Nat using (ℕ; _+_)<br>
<br>
module M11 (p : ℕ)<br>
where<br>
f : ℕ → ℕ<br>
f x = p + x<br>
<br>
------------------------------<wbr>----------<br>
module M2 where<br>
open import Data.Nat using (ℕ; suc)<br>
open import M1 using (module M11)<br>
<br>
open M11 2 using (f)<br>
<br>
g : ℕ → ℕ<br>
g x = f (suc x)<br>
------------------------------<wbr>-----------<br>
<br>
And suppose that M1 is type-checked earlier.<br>
<br>
1) Then, how eager is the type checker in processing the definition<br>
for g ?<br>
<br>
Probably, it substitutes 2 into the body of M11, and into f,<br>
and it becomes<br>
f x = 2 + x.<br>
<br>
Then it normalizes everything, and f becomes f x = suc (suc x).<br>
<br>
Then it substitutes the obtained definition for f into the definition<br>
for g, and normalizes this to<br>
g x = suc (suc (suc x)).<br>
<br>
Right?<br>
<br>
Or may be, it delays the above operations for where g is used?<br>
<br>
2) If we comment out the last two lines for g,<br>
then will the type checker do the above substitution into M11 and<br>
normalization for the definition of f ?<br>
<br>
Thanks,<br>
<br>
------<br>
Sergei<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
Agda mailing list<br>
<a href="mailto:Agda@lists.chalmers.se">Agda@lists.chalmers.se</a><br>
<a href="https://lists.chalmers.se/mailman/listinfo/agda" rel="noreferrer" target="_blank">https://lists.chalmers.se/<wbr>mailman/listinfo/agda</a><br>
</blockquote></div><br></div></div></div>