Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>At the moment there are two widely used major versions of Parsec, Parsec 2 and Parsec 3.</p> <p>My advice is simply to use the latest release of Parsec 3. But if you want to make a conscious choice, read on.</p> <h2>New in Parsec 3</h2> <h3>Monad Transformer</h3> <p>Parsec 3 introduces a monad transformer, <code>ParsecT</code>, which can be used to combine parsing with other monadic effects.</p> <h3>Streams</h3> <p>Although Parsec 2 lets you to choose the token type (which is useful when you want to separate lexical analysis from the parsing), the tokens are always arranged into lists. List may be not the most efficient data structure to store large texts.</p> <p>Parsec 3 can work with arbitrary <em>streams</em> -- data structures with list-like interface. You can define your own streams, but Parsec 3 also includes a popular and efficient Stream implementation based on ByteString (for <code>Char</code>-based parsing), exposed through the modules <code>Text.Parsec.ByteString</code> and <code>Text.Parsec.ByteString.Lazy</code>.</p> <h2>Reasons to prefer Parsec 2</h2> <h3>Less extensions required</h3> <p>Advanced features provided by Parsec 3 do not come for free: to implement them several language extensions are required.</p> <p>Neither of the two versions is Haskell-2010 (i.e. both use extensions), but Parsec 2 uses less extensions than Parsec 3, so chances that any given compiler can compile Parsec 2 are higher than those for Parsec 3.</p> <p>By this time both versions work with GHC, while Parsec 2 is also <a href="http://www.haskell.org/pipermail/haskell/2011-January/022532.html" rel="nofollow noreferrer">reported</a> to build with JHC and is included as one of the JHC's standard libraries.</p> <h3>Performance</h3> <p>Originally (i.e. as of 3.0 version) Parsec 3 was considerably slower than Parsec 2. However, <a href="http://panicsonic.blogspot.com/2009/12/adventures-in-parsec.html" rel="nofollow noreferrer">work on improving Parsec 3 performance</a> has been done, and as of version 3.1 Parsec 3 is only slightly slower than Parsec 2 (benchmarks: <a href="http://www.haskell.org/pipermail/haskell-cafe/2009-December/070196.html" rel="nofollow noreferrer">1</a>, <a href="http://www.mail-archive.com/haskell-cafe@haskell.org/msg79296.html" rel="nofollow noreferrer">2</a>).</p> <h2>Compatibility layer</h2> <p>It has been possible to "reimplement" all of the Parsec 2 API in Parsec 3. This compatibility layer is provided by the Parsec 3 package under the module hierarchy <code>Text.ParserCombinators.Parsec</code> (the same hierarchy which is used by Parsec 2), while the new Parsec 3 API is available under the <code>Text.Parsec</code> hierarchy.</p> <p>This means that you can use Parsec 3 as a drop-in replacement for Parsec 2.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload