<br><br><div class="gmail_quote">On Wed, Jan 28, 2009 at 7:56 AM, Juraj Hercek <span dir="ltr">&lt;<a href="mailto:juhe_haskell@hck.sk">juhe_haskell@hck.sk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello people,<br>
<br>
I&#39;ve recently tried this:<br>
<br>
$ uname -smpr<br>
Linux 2.6.28-ARCH x86_64 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz<br>
$ ghci<br>
GHCi, version 6.10.1: <a href="http://www.haskell.org/ghc/" target="_blank">http://www.haskell.org/ghc/</a> &nbsp;:? for help<br>
Loading package ghc-prim ... linking ... done.<br>
Loading package integer ... linking ... done.<br>
Loading package base ... linking ... done.<br>
Prelude&gt; a &lt;- readFile &quot;/sys/devices/system/cpu/online&quot;<br>
Prelude&gt; length a `seq` a<br>
&quot;^CInterrupted.<br>
Prelude&gt; writeFile &quot;/tmp/test.txt&quot; &quot;12345\n&quot;<br>
Prelude&gt; b &lt;- readFile &quot;/tmp/test.txt&quot;<br>
Prelude&gt; length b `seq` b<br>
&quot;12345\n&quot;<br>
Prelude&gt;<br>
<br>
The main problem is the &quot;C^Interrupted.&quot; above. The input doesn&#39;t get read out till the end of the file for some reason when dealing with files in /sys directory (tried also others: /sys/devices/plaform/coretemp.0/temp1_input or /sys/devices/system/cpu/cpu0/cpufreq/cpufreq_cur_freq). Sometimes, the string from file in /sys gets read (with a slow delay), but most of the times it didn&#39;t. Everything works fine for a file in /tmp. Cat-ing files from shell works perfectly in /sys and /tmp.<br>

<br>
I tried also other machine:<br>
% uname -smpr<br>
Linux 2.6.28-ARCH i686 Intel(R) Pentium(R) 4 CPU 2.00GHz<br>
<br>
with the same effect. I didn&#39;t have this problem with ghc-6.8.2.<br>
<br>
Any idea?</blockquote><div><br></div><div>Well readFile is a lazy getContents:</div><div><br></div><div><span class="Apple-style-span" style="font-family: -webkit-sans-serif; font-size: 16px; ">The&nbsp;<tt style="font-size: 100%; "><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v%3AgetContents" style="color: rgb(0, 0, 224); text-decoration: none; ">getContents</a></tt>&nbsp;operation returns all user input as a single string,</span><br>
</div><div><br></div><div>so per the documentation reading the whole file is the documented behavior.</div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
<br>
-- Juraj<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br>