<div dir="ltr">Hello Haskell-beginners,<br><br>I&#39;m trying to work through the &quot;Write Yourself a Scheme in 48 Hours&quot; tutorial. One of the<br>first exercises calls for writing code to sum up arguments on command line and display<br>
the sum.<br><br>After a few tries, this worked for me:<br><br>module Main where<br>import System.Environment<br><br>main :: IO ()<br>main = do args &lt;- getArgs<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; putStrLn (&quot;Hello, &quot; ++ show (sumIt args))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where sumIt x = sum $ map read x<br><br>However, I have two basic questions:<br><br>1. I initially tried putStrLn(&quot;Hello, &quot; ++ show $ sumIt args), but that didn&#39;t compile. Why not?<br>If I wrap (show $ sumIt args) in parens, it works, but should I have to, if I didn&#39;t have to in<br>
the original code above?<br><br>2. I initially tried <br><br>where sumIt = sum $ map read<br><br>(the &quot;point-free&quot; style, I believe it&#39;s called?) but that didn&#39;t compile. Why not? A friend suggested<br><br>
where sumIt = sum . map read<br><br>and that does work; I guess my real problem, then, is that I don&#39;t really understand the difference <br>between the two and why the former doesn&#39;t work.<br><br>Thanks in advance,<br>
Anatoly.<br><br>-- <br>Anatoly Vorobey, <a href="mailto:avorobey@gmail.com">avorobey@gmail.com</a><br><a href="http://avva.livejournal.com">http://avva.livejournal.com</a> (Russian)<br><a href="http://www.lovestwell.org">http://www.lovestwell.org</a> (English)<br>

</div>