title: Haskell: Parse error: module header, import declaration or top-level declaration expected
body: <p>I am saving some commands in a Haskell script in a .hs file while working thru a Haskell textbook. Here's a small example.</p>
  
  <pre><code>fst (1,2)
  snd (1,2)
  </code></pre>
  
  <p>When I run these commands from the prelude in GHCi, they work fine. When I try to compile the .hs file with these two lines, I get the following:</p>
  
  <pre><code>ch4_test.hs:2:1: error:
      Parse error: module header, import declaration
      or top-level declaration expected.
    |
  2 | fst (1,2)
    | ^^^^^^^^^
  Failed, no modules loaded.
  </code></pre>
  
  <p>I've googled this error and can't find any explanation what I'm doing wrong.</p>