title: Should I avoid using interactive mode?
body: <p>Haskell newbie here. I use <code>ghci</code> to implement a baby <code>quicksort</code> algorithm [1] as follows:</p>
  
  <pre><code>Prelude&gt; quicksort (firstx:xs) = quicksort[x|x&lt;-xs, x&lt;firstx] ++ [firstx] ++ quicksort[x|x&lt;-xs, not(x&lt;firstx)]
  Prelude&gt; quicksort [] = []
  </code></pre>
  
  <p>The command <code>quicksort [1,2,3]</code> then gives an error: </p>
  
  <blockquote>
    <p>*** Exception: :8:1-17: Non-exhaustive patterns in function quicksort</p>
  </blockquote>
  
  <p>However, typing the exact same thing in an <code>quicksort.hs</code> file and running <code>$ ghci quicksort.hs</code> do not yield such an error.</p>
  
  <h3>Question</h3>
  
  <p>What makes the difference? Is it a rule of thumb that one should avoid using interactive mode?</p>
  
  Reference
  
  <p>[1] Rex Page. Two Dozen Short Lessons in Haskell</p>