title: Load pure global variable from file
body: <p>I have a file with some data in it. This data never changes and I want to make it available outside of the IO monad. How can I do that?</p>
  
  <p>Example (note that this is just an example, my data is not computable):</p>
  
  <p>primes.txt:</p>
  
  <blockquote>
    <p>2 3 5 7 13</p>
  </blockquote>
  
  <p>code.hs:</p>
  
  <pre><code>primes :: [Int]
  primes = map read . words . unsafePerformIO . readFile $ "primes.txt"
  </code></pre>
  
  <p>Is this a "legal" use of <code>unsafePerformIO</code>? Are there alternatives?</p>