
23 Oct
2009
23 Oct
'09
3:48 a.m.
Hello zaxis, Friday, October 23, 2009, 11:15:01 AM, you wrote:
good_ssq_red = withFile "ssqHitNum.txt" ReadMode (\h -> do { samp <- fmap str2Ints $ hGetContents h; print samp; --without this line, the result will always [1..16] return $ statis samp; })
withFile and hGetContents shouldn't be used together. both closes file handle and, here, withFile closes it before hGetContents lazily reads data. it's why you need to force reading with print use readFile instead -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com