title: Haskell - read string from keyboard
body: <p>I am trying to read a string from keyboard. This is my code so far:</p>
  
  <pre><code>getLine :: IO String
  getLine = do x &lt;- getChar if x=='\n' then return [] else do xs&lt;-getLine return (x:xs)
  </code></pre>
  
  <p>The problem is that I get this error when compiling:</p>
  
  <blockquote>
    <p>parse error on input 'if'</p>
  </blockquote>
  
  <p>Any ideas what I am doing wrong?</p>