title: Couldn't convert an IO String to [Char] in Haskell
body: <p>I wrote this simple function that takes two file names (String) and wrote the content of the first file into the second file applying <code>toUpper</code> to each character.</p>
  
  <pre><code>import Data.Char
  
  ioFile f1 f2 = do
              s &lt;- readFile f1
              sUp &lt;- [toUpper c | c &lt;- s]
              writeFile f2 sUp
  </code></pre>
  
  <p>But the interpreter raise an error</p>
  
  <pre><code>Couldn't match expected type ‘IO String’ with actual type ‘[Char]’
  In a stmt of a 'do' block: sUp &lt;- [toUpper c | c &lt;- s]
  In the expression:
    do { s &lt;- readFile f1;
         sUp &lt;- [toUpper c | c &lt;- s];
         writeFile f2 sUp }
  In an equation for ‘ioFile’:
      ioFile f1 f2
        = do { s &lt;- readFile f1;
               sUp &lt;- [toUpper c | c &lt;- s];
               writeFile f2 sUp }
  </code></pre>
  
  <p>How can I use <code>s</code> as a <code>[Char]</code> instead of <code>IO String</code>?</p>