Understanding Type of IO () in `let` Expression : <p>Given:</p>

<pre><code>λ: let f = putStrLn "foo" in 42
42
</code></pre>

<p>What is <code>f</code>'s type? Why does <code>"foo"</code> not get printed before showing the result of <code>42</code>?</p>

<p>Lastly, why doesn't the following work?</p>

<pre><code>λ: :t f

&lt;interactive&gt;:1:1: Not in scope: ‘f’
</code></pre>
