title: Haskell: parse error possibly incorrect indentation or mismatched brackets
body: <p>When I try to use the function below to implement a function like below the compiler return </p>
  
  <blockquote>
    <p>parse error (possibly incorrect indentation or mismatched brackets)</p>
  </blockquote>
  
  <p>The function:</p>
  
  <blockquote>
    <p>demo 8 [1,2,3]    should return   [1,2,3,1,2,3,1,2]</p>
  </blockquote>
  
  <pre><code> demo :: Int -&gt; [a] -&gt; [a] 
      let n = 0 
      demo arg [] = [] 
      demo arg (x:xs) = 
           if arg &lt;= length (x:xs) then
               take arg (x:xs) 
           else
               let (x:xs) = (x:xs) ++ (x:xs)!!n
               arg = arg - 1
               n = n + 1
               demo arg (x:xs)
  </code></pre>
  
  <p>How can I correct that?
  Regards!</p>