<div style="color:#000; font-size: 14px;font-family: arial;"><div><span style="max-width: 122px;" class="txt js-text  f-size-huge">Carsten and Arjanen,<br><br>Thanks for your explanation.  :)<br></span></div><div><br></div><div><br></div><div><br></div></div><div id="spnEditorSign" name="100"><div><div>--m00nlight<br></div></div></div><div><br></div><!-- jy5ContentSuffix --><div>在2015年03月08 20时01分, "arjanen.loic"<arjanen.loic@gmail.com>写道:</div><blockquote id="isReplyContent" style="padding-left: 1ex; margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204);"><br><style data-externalstyle="true"><!--
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
}
p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin:0in;
margin-bottom:.0001pt;
}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst, 
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle, 
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:115%;
}
--></style><div data-externalstyle="false" dir="ltr" style="font-family: Calibri, Segoe UI, Meiryo, Microsoft YaHei UI, Microsoft JhengHei UI, Malgun Gothic, sans-serif;font-size:12pt;"><div>Hello,</div><div><br></div><div>Given that you specifically indicated in your code that you wanted Int’s instance of Read and that the result of the product is way over 2 ^ 32 (or 2 ^ 64 for that matter), I’d guess the difference comes from the fact that the product of a is done with type Int (that is, modulo 32 or 64 depending on your computer’s CPU architecture) and the product with the litteral list is done with type Integer because that the type Haskell defaults to in this case.<br></div><div data-signatureblock="true"><div><br></div><div>ARJANEN Loïc Jean David<br>http://blog.luigiscorner.com<br>--- <br>“Computer science is no more about computers than astronomy is about telescopes, biology is about microscopes, or chemistry is about beakers and test tubes. Science is not about tools. It is about how we use them, and what we find out when we do.”<br>Michael R. Fellows and Ian Parberry</div><div><br></div></div><div style="padding-top: 5px; border-top-color: rgb(229, 229, 229); border-top-width: 1px; border-top-style: solid;"><div><font style="line-height: 15pt; letter-spacing: 0.02em; font-family: "Calibri", "Segoe UI", "Meiryo", "Microsoft YaHei UI", "Microsoft JhengHei UI", "Malgun Gothic", "sans-serif"; font-size: 12pt;" face="'Calibri', 'Segoe UI', 'Meiryo', 'Microsoft YaHei UI', 'Microsoft JhengHei UI', 'Malgun Gothic', 'sans-serif'"><b>De :</b> <a href="mailto:dot_wangyushi@yeah.net" target="_parent">m00nlight</a><br><b>Envoyé :</b> ‎dimanche‎ ‎8‎ ‎mars‎ ‎2015 ‎21‎:‎59<br><b>À :</b> <a href="mailto:beginners@haskell.org" target="_parent">The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell</a></font></div></div><div><br></div><div dir=""><div style="color: rgb(0, 0, 0); font-family: arial; font-size: 14px;">    <div>Hi Haskellers,<br><br>I encounter an strange behavior of haskell program recently.  The following is my program<br><br>```haskell<br>main = do<br>    _ <- getLine<br>    arr1 <- getLine<br>    _ <- getLine<br>   arr2 <- getLine<br>   let a = map (read :: String -> Int) (words arr1)<br>        b = map (read :: String -> Int) (words arr2)<br><br>  putStrLn $ show $ (foldl (*) 1 a)<br>  putStrLn $ show $ a == [1,2,4,8,32,64,128,256,512,1024,2048,4906,8192]<br>  putStrLn $ show $ (foldl (*) 1 [1,2,4,8,32,64,128,256,512,1024,2048,4906,8192])<br>```<br><br>With the input test file as following:<br><br>```test.in<br>13<br>1 2 4 8 32 64 128 256 512 1024 2048 4906 8192<br>9<br>1 3 9 27 81 243 729 2187 6561<br>```<br><br>The output is as:<br>```output<br>0<br>True<br>185343439719667835347140608<br>```<br><br>In fact, from the program, we know that a is equal to list  [1,2,4,8,32,64,128,256,512,1024,2048,4906,8192] ,<br>but the product of a and the literal list is different.<br><br>Can anyone tell me why?<br><br>Thanks       <br><br></div><div><br></div><div><br></div><div><br></div></div><div><div><div>--m00nlight<br></div></div></div><div><br></div><br><br><span><span id="netease_mail_footer"><span><span id="netease_mail_footer"></span></span></span></span></div></div></blockquote><br><br><span title="neteasefooter"><span id="netease_mail_footer"><span title="neteasefooter"><span id="netease_mail_footer"><a href="#" target="_blank"></a></span></span>
</span></span>