
Parsec is a monadic combinator library that is well-documented, simple to use, and produces good error messages. Parsec is not inherently lazy/incremental and is not well-suited to handling large quantities of simply formatted data. Parsec 3 adds to Parsec the ability to use Parsec as a monad transformer and generalizes the input Parsec accepts. Parsec 3 includes a compatibility layer for Parsec 2 and should be a drop-in replacement for code using Parsec 2. Code using the features of Parsec 3 should use the modules in Text.Parsec. Due almost entirely to the work of Antoine Latter there is a new version of Parsec 3 available. He documented some of his thoughts on this in this series of blog posts: http://panicsonic.blogspot.com/2009/12/adventures-in-parsec.html The main features of this release are: - the performance should be much better and comparable to Parsec 2 - notFollowedBy's type and behavior have been generalized Changes: - the changes to the core of Parsec lead to some changes to when things get executed when it is used as a monad transformer "In the new version bind, return and mplus no longer run in the inner monad, so if the inner monad was side-effecting for these actions the behavior of existing code will change." - notFollowedBy p now behaves like notFollowedBy (try p) which changes the behavior slightly when p consumes input, though the behavior should be more natural now. - the set of names exported from Text.Parsec.Prim has changed somewhat

By coincidence, today I found a bug in the parsec 3.0.[01]. Probably due to changes introduced the bug is absent in parsec 3.1.0. I think it is worth to release 3.0.2 with this bug fixed. The bug itself is demonstrated in the following code. It gives Right (False,True) with parsec-3.0.x while should be giving Right (False,False). And, by the way, does parsec have any code repository and/or bug tracker?
import Text.Parsec hiding (parse) import Control.Monad.Reader
type Parser = ParsecT String () (Reader Bool)
change :: Parser a -> Parser a change p = local (const False) p
p = change $ do was <- ask anyChar now <- ask return (was,now)
parse :: Parser a -> SourceName -> String -> Either ParseError a parse p name s = runReader (runPT p () name s) True
main = print $ parse p "" "a"
* Derek Elkins
Changes: - the changes to the core of Parsec lead to some changes to when things get executed when it is used as a monad transformer "In the new version bind, return and mplus no longer run in the inner monad, so if the inner monad was side-effecting for these actions the behavior of existing code will change." - notFollowedBy p now behaves like notFollowedBy (try p) which changes the behavior slightly when p consumes input, though the behavior should be more natural now. - the set of names exported from Text.Parsec.Prim has changed somewhat
-- Roman I. Cheplyaka :: http://ro-che.info/ "Don't let school get in the way of your education." - Mark Twain

Sweet :)
I'm glad that notFollowedBy has been fixed. I've often had to redefine it
because the type was to restrictive.
- Job
On Wed, Mar 3, 2010 at 11:45 PM, Derek Elkins
Parsec is a monadic combinator library that is well-documented, simple to use, and produces good error messages. Parsec is not inherently lazy/incremental and is not well-suited to handling large quantities of simply formatted data. Parsec 3 adds to Parsec the ability to use Parsec as a monad transformer and generalizes the input Parsec accepts. Parsec 3 includes a compatibility layer for Parsec 2 and should be a drop-in replacement for code using Parsec 2. Code using the features of Parsec 3 should use the modules in Text.Parsec.
Due almost entirely to the work of Antoine Latter there is a new version of Parsec 3 available. He documented some of his thoughts on this in this series of blog posts: http://panicsonic.blogspot.com/2009/12/adventures-in-parsec.html
The main features of this release are: - the performance should be much better and comparable to Parsec 2 - notFollowedBy's type and behavior have been generalized
Changes: - the changes to the core of Parsec lead to some changes to when things get executed when it is used as a monad transformer "In the new version bind, return and mplus no longer run in the inner monad, so if the inner monad was side-effecting for these actions the behavior of existing code will change." - notFollowedBy p now behaves like notFollowedBy (try p) which changes the behavior slightly when p consumes input, though the behavior should be more natural now. - the set of names exported from Text.Parsec.Prim has changed somewhat _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (4)
-
Derek Elkins
-
Felipe Lessa
-
Job Vranish
-
Roman Cheplyaka