title: Haskell Parsec combinator 'many' is applied to a parser that accepts an empty string
body: <pre><code>import Text.ParserCombinators.Parsec
  
  delimiter :: Parser ()
  delimiter = do char '|'
                 return ()
            &lt;?&gt; "delimiter"
  
  
  eol :: Parser ()
  eol = do oneOf "\n\r"
           return ()
      &lt;?&gt; "end of line"
  
  item :: Parser String
  item = do entry &lt;- manyTill anyChar (try eol &lt;|&gt; try delimiter &lt;|&gt; eof)
            return entry
  
  items :: Parser [String]
  items = do result &lt;- many item
             return result
  </code></pre>
  
  <p>When I run <code>parseTest items "a|b|c"</code> with the code above I get the following error: </p>
  
  <pre><code>*** Exception: Text.ParserCombinators.Parsec.Prim.many: 
  combinator 'many' is applied to a parser that accepts an empty string.
  </code></pre>
  
  <p>I believe it has something to do with <code>eof</code> and <code>many item</code>, if I remove <code>eof</code>, then I can get it to work as long as the line does not end in <code>eof</code>, which makes it kind of useless.</p>
  
  <p>I realize I could just use <code>sepBy</code> but what I am interested in is why this code does not work and how to make it work.</p>