title: Reading from input files in haskell
body: <p>I am solving <a href="http://projecteuler.net/problem=11" rel="nofollow">Project Euler Problem 11</a>. I have copy-pasted the table in the problem into a file called "input.txt". Each line of the input file contains a row of a 20x20 matrix, and the columns are separated by whitespace.</p>
  
  <p>What I want is a function that reads this file, and returns it as an IO Array. I'm having huge trouble doing this.</p>
  
  <p>So far I've done this:</p>
  
  <pre><code>import System.IO
  import Control.Monad
  
  main = readFile "input.txt"
  </code></pre>
  
  <p>This of course only gives me the IO String representation of the input file, but everything I try seems to fail. How should I proceed? I know I should do something like</p>
  
  <pre><code>array ((1,1),(20,20)) [ the numbers tupled with their indices ]
  </code></pre>
  
  <p>but converting the numbers is outright impossible for me, most likely because I do not entirely understand monads yet.</p>
  
  <p>I am confident that this is in fact quite easy, once you understand it.</p>
  
  <p>Does anyone have a suggestion about what to do?</p>