<div dir="ltr">One problem in <i>Programming Haskell from First Principles</i> confuses me. (So far.)<div><br></div><div>It's one where you start with the declaration and binding</div><div><br></div><div><font face="courier new, monospace">i :: Num a => a</font></div><div><font face="courier new, monospace">i = 1</font></div><div><br></div><div>(which of course works because <font face="courier new, monospace">Num a => a</font> is the type of 1) and then change the declaration to</div><div><br></div><div><font face="courier new, monospace">i :: a</font></div><div><br></div><div>and first try to predict and then see what happens. It fails, with ghci suggesting that you put the <font face="courier new, monospace">Num a =></font> back. That seemed reasonable at first, but then I considered this:</div><div><ul><li><font face="courier new, monospace">id</font> has type <font face="courier new, monospace">a -> a</font>, and if you try to evaluate <font face="courier new, monospace">id 1</font> it works without complaint.</li><li>In all the work I've done on compilers, parameter passing has effectively been assignment of actual parameters to the corresponding formal parameters. In Haskell, that might mean passing along the appropriate thunk, but the principle is the same, isn't it?</li></ul><div>So, if I can't bind 1 to i which is declared to have type a, why can I successfully pass 1 to id?</div></div></div>