title: Haskell Noob question: What's wrong with my append function?
body: <p>I'm trying to write a Haskell append function... Here's what I have:</p>
  
  <pre><code>myappend :: [a] -&gt; [a] -&gt; [a]
  myappend [] x = x
  myappend [x:xs] y = x : myappend xs y
  </code></pre>
  
  <p>But it's giving me an error:
      Occurs check: cannot construct the infinite type: a = [a]
      When generalising the type(s) for `myappend'</p>
  
  <p>So, obviously there's something wrong with it but I can't see it... What's wrong with my append function?</p>