title: Parsec: How to silence parser errors about white spaces
body: <p>I have the following parser for parsing BASH-like lines containing redirection.</p>
  
  <pre><code>lineRedirect :: P.Parsec String () String
  lineRedirect = do
    lcmd &lt;- P.spaces *&gt; (P.many1 command P.&lt;?&gt; "command")
    P.char '&gt;'
    rcmd &lt;- P.spaces *&gt; (P.many1 command P.&lt;?&gt; "redirection target")
    return $ (intercalate ";" lcmd) ++ " ++ " ++ (intercalate ";" rcmd)   
    where
      command :: P.Parsec String () String
      command = P.many1 P.alphaNum &lt;* P.spaces
  </code></pre>
  
  <p>It seems to be working just fine, but I'd like to silence any "expecting space" or "expecting whitespace" that appear.</p>
  
  <p>For example:</p>
  
  <pre><code>&gt; P.parseTest lineRedirect "   &gt; target"
  parse error at (line 1, column 4):
  unexpected "&gt;"
  expecting space or command
  </code></pre>
  
  <p>I'd like to have just "expecting command" here.</p>
  
  <pre><code>&gt; P.parseTest lineRedirect "invalid! &gt; target"
  parse error at (line 1, column 8):
  unexpected "!"
  expecting letter or digit, white space or "&gt;"
  </code></pre>
  
  <p>Same here, without the "white space".</p>