Haskell read Integer and list of lists from file
<p>Lets say I have a file</p>

<pre><code>8 [[1,2,3,4],[1,2]]
</code></pre>

<p>with number and list of lists in it.</p>

<p>This code allow me to read all line or n-th element from it.</p>

<pre><code>import System.IO

main = do
      x &lt;- openFile "file.txt" ReadMode
      cont &lt;- hGetContents x
      let fLines = lines cont
      let numb = fLines !! 0 !! 0
      print numb
</code></pre>

<p>here <code>numb</code> is <code>'8'</code>.</p>

<p>How can I get integer 8 from <code>numb</code> without using other libraries? </p>

<p>And is there a possibility to read list of lists and use it as list of lists?</p>

<p>Or should I better write each list in a new row, and read them row by row and add to empty list?</p>

<p>Maybe it's a stupid question, but I didn't find any example of doing something like that on internet.</p>

<p><strong>UPDATE</strong></p>

<p>Thanks to Fractal  answer I've managed to write this </p>

<pre><code>rList :: String -&gt; [[Int]]    
rList = read
</code></pre>

<p>which is working for list of lists!</p>

<p>However, when I cant make it work with single Int.</p>

<pre><code>into :: String -&gt; Int
into = read
</code></pre>

<p>Don't know why, but it doesn't work for <code>numb</code> T_T</p>

<p><strong>UPDATE 2</strong></p>

<p>Ok, it was kinda stupid. <code>numb</code> is Char here, so to make it work it will be enough to write </p>

<pre><code>print (into [numb])
</code></pre>

<p>Thank you all for answers.</p>