parsers 0.12 → 0.12.1
raw patch · 6 files changed
+39/−32 lines, 6 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Text.Parser.Char: instance (CharParsing m, MonadPlus m, Monoid w, Show w) => CharParsing (WriterT w m)
- Text.Parser.Char: instance (CharParsing m, MonadPlus m, Monoid w, Show w, Show s) => CharParsing (RWST r w s m)
- Text.Parser.Char: instance (CharParsing m, MonadPlus m, Show s) => CharParsing (StateT s m)
- Text.Parser.Combinators: instance (Parsing m, MonadPlus m, Monoid w, Show w) => Parsing (WriterT w m)
- Text.Parser.Combinators: instance (Parsing m, MonadPlus m, Monoid w, Show w, Show s) => Parsing (RWST r w s m)
- Text.Parser.Combinators: instance (Parsing m, MonadPlus m, Show s) => Parsing (StateT s m)
- Text.Parser.LookAhead: instance (LookAheadParsing m, MonadPlus m, Monoid w, Show w) => LookAheadParsing (WriterT w m)
- Text.Parser.LookAhead: instance (LookAheadParsing m, MonadPlus m, Monoid w, Show w, Show s) => LookAheadParsing (RWST r w s m)
- Text.Parser.LookAhead: instance (LookAheadParsing m, MonadPlus m, Show s) => LookAheadParsing (StateT s m)
- Text.Parser.Token: instance (TokenParsing m, MonadPlus m, Monoid w, Show w) => TokenParsing (WriterT w m)
- Text.Parser.Token: instance (TokenParsing m, MonadPlus m, Monoid w, Show w, Show s) => TokenParsing (RWST r w s m)
- Text.Parser.Token: instance (TokenParsing m, MonadPlus m, Show s) => TokenParsing (StateT s m)
+ Text.Parser.Char: instance (CharParsing m, MonadPlus m) => CharParsing (StateT s m)
+ Text.Parser.Char: instance (CharParsing m, MonadPlus m, Monoid w) => CharParsing (RWST r w s m)
+ Text.Parser.Char: instance (CharParsing m, MonadPlus m, Monoid w) => CharParsing (WriterT w m)
+ Text.Parser.Combinators: instance (Parsing m, MonadPlus m) => Parsing (StateT s m)
+ Text.Parser.Combinators: instance (Parsing m, MonadPlus m, Monoid w) => Parsing (RWST r w s m)
+ Text.Parser.Combinators: instance (Parsing m, MonadPlus m, Monoid w) => Parsing (WriterT w m)
+ Text.Parser.LookAhead: instance (LookAheadParsing m, MonadPlus m) => LookAheadParsing (StateT s m)
+ Text.Parser.LookAhead: instance (LookAheadParsing m, MonadPlus m, Monoid w) => LookAheadParsing (RWST r w s m)
+ Text.Parser.LookAhead: instance (LookAheadParsing m, MonadPlus m, Monoid w) => LookAheadParsing (WriterT w m)
+ Text.Parser.Token: instance (TokenParsing m, MonadPlus m) => TokenParsing (StateT s m)
+ Text.Parser.Token: instance (TokenParsing m, MonadPlus m, Monoid w) => TokenParsing (RWST r w s m)
+ Text.Parser.Token: instance (TokenParsing m, MonadPlus m, Monoid w) => TokenParsing (WriterT w m)
Files
- parsers.cabal +1/−1
- src/Text/Parser/Char.hs +6/−6
- src/Text/Parser/Combinators.hs +12/−12
- src/Text/Parser/LookAhead.hs +6/−6
- src/Text/Parser/Token.hs +6/−6
- tests/QuickCheck.hs +8/−1
parsers.cabal view
@@ -1,6 +1,6 @@ name: parsers category: Text, Parsing-version: 0.12+version: 0.12.1 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE
src/Text/Parser/Char.hs view
@@ -223,7 +223,7 @@ text t = t <$ string (unpack t) {-# INLINE text #-} -instance (CharParsing m, MonadPlus m, Show s) => CharParsing (Lazy.StateT s m) where+instance (CharParsing m, MonadPlus m) => CharParsing (Lazy.StateT s m) where satisfy = lift . satisfy {-# INLINE satisfy #-} char = lift . char@@ -237,7 +237,7 @@ text = lift . text {-# INLINE text #-} -instance (CharParsing m, MonadPlus m, Show s) => CharParsing (Strict.StateT s m) where+instance (CharParsing m, MonadPlus m) => CharParsing (Strict.StateT s m) where satisfy = lift . satisfy {-# INLINE satisfy #-} char = lift . char@@ -265,7 +265,7 @@ text = lift . text {-# INLINE text #-} -instance (CharParsing m, MonadPlus m, Monoid w, Show w) => CharParsing (Strict.WriterT w m) where+instance (CharParsing m, MonadPlus m, Monoid w) => CharParsing (Strict.WriterT w m) where satisfy = lift . satisfy {-# INLINE satisfy #-} char = lift . char@@ -279,7 +279,7 @@ text = lift . text {-# INLINE text #-} -instance (CharParsing m, MonadPlus m, Monoid w, Show w) => CharParsing (Lazy.WriterT w m) where+instance (CharParsing m, MonadPlus m, Monoid w) => CharParsing (Lazy.WriterT w m) where satisfy = lift . satisfy {-# INLINE satisfy #-} char = lift . char@@ -293,7 +293,7 @@ text = lift . text {-# INLINE text #-} -instance (CharParsing m, MonadPlus m, Monoid w, Show w, Show s) => CharParsing (Lazy.RWST r w s m) where+instance (CharParsing m, MonadPlus m, Monoid w) => CharParsing (Lazy.RWST r w s m) where satisfy = lift . satisfy {-# INLINE satisfy #-} char = lift . char@@ -307,7 +307,7 @@ text = lift . text {-# INLINE text #-} -instance (CharParsing m, MonadPlus m, Monoid w, Show w, Show s) => CharParsing (Strict.RWST r w s m) where+instance (CharParsing m, MonadPlus m, Monoid w) => CharParsing (Strict.RWST r w s m) where satisfy = lift . satisfy {-# INLINE satisfy #-} char = lift . char
src/Text/Parser/Combinators.hs view
@@ -278,7 +278,7 @@ -- > keywordLet = try $ string "let" <* notFollowedBy alphaNum notFollowedBy :: Show a => m a -> m () -instance (Parsing m, MonadPlus m, Show s) => Parsing (Lazy.StateT s m) where+instance (Parsing m, MonadPlus m) => Parsing (Lazy.StateT s m) where try (Lazy.StateT m) = Lazy.StateT $ try . m {-# INLINE try #-} Lazy.StateT m <?> l = Lazy.StateT $ \s -> m s <?> l@@ -288,10 +288,10 @@ eof = lift eof {-# INLINE eof #-} notFollowedBy (Lazy.StateT m) = Lazy.StateT- $ \s -> notFollowedBy (m s) >> return ((),s)+ $ \s -> notFollowedBy (fst <$> m s) >> return ((),s) {-# INLINE notFollowedBy #-} -instance (Parsing m, MonadPlus m, Show s) => Parsing (Strict.StateT s m) where+instance (Parsing m, MonadPlus m) => Parsing (Strict.StateT s m) where try (Strict.StateT m) = Strict.StateT $ try . m {-# INLINE try #-} Strict.StateT m <?> l = Strict.StateT $ \s -> m s <?> l@@ -301,7 +301,7 @@ eof = lift eof {-# INLINE eof #-} notFollowedBy (Strict.StateT m) = Strict.StateT- $ \s -> notFollowedBy (m s) >> return ((),s)+ $ \s -> notFollowedBy (fst <$> m s) >> return ((),s) {-# INLINE notFollowedBy #-} instance (Parsing m, MonadPlus m) => Parsing (ReaderT e m) where@@ -318,7 +318,7 @@ notFollowedBy (ReaderT m) = ReaderT $ notFollowedBy . m {-# INLINE notFollowedBy #-} -instance (Parsing m, MonadPlus m, Monoid w, Show w) => Parsing (Strict.WriterT w m) where+instance (Parsing m, MonadPlus m, Monoid w) => Parsing (Strict.WriterT w m) where try (Strict.WriterT m) = Strict.WriterT $ try m {-# INLINE try #-} Strict.WriterT m <?> l = Strict.WriterT (m <?> l)@@ -328,10 +328,10 @@ eof = lift eof {-# INLINE eof #-} notFollowedBy (Strict.WriterT m) = Strict.WriterT- $ notFollowedBy m >>= \x -> return (x, mempty)+ $ notFollowedBy (fst <$> m) >>= \x -> return (x, mempty) {-# INLINE notFollowedBy #-} -instance (Parsing m, MonadPlus m, Monoid w, Show w) => Parsing (Lazy.WriterT w m) where+instance (Parsing m, MonadPlus m, Monoid w) => Parsing (Lazy.WriterT w m) where try (Lazy.WriterT m) = Lazy.WriterT $ try m {-# INLINE try #-} Lazy.WriterT m <?> l = Lazy.WriterT (m <?> l)@@ -341,10 +341,10 @@ eof = lift eof {-# INLINE eof #-} notFollowedBy (Lazy.WriterT m) = Lazy.WriterT- $ notFollowedBy m >>= \x -> return (x, mempty)+ $ notFollowedBy (fst <$> m) >>= \x -> return (x, mempty) {-# INLINE notFollowedBy #-} -instance (Parsing m, MonadPlus m, Monoid w, Show w, Show s) => Parsing (Lazy.RWST r w s m) where+instance (Parsing m, MonadPlus m, Monoid w) => Parsing (Lazy.RWST r w s m) where try (Lazy.RWST m) = Lazy.RWST $ \r s -> try (m r s) {-# INLINE try #-} Lazy.RWST m <?> l = Lazy.RWST $ \r s -> m r s <?> l@@ -354,10 +354,10 @@ eof = lift eof {-# INLINE eof #-} notFollowedBy (Lazy.RWST m) = Lazy.RWST- $ \r s -> notFollowedBy (m r s) >>= \x -> return (x, s, mempty)+ $ \r s -> notFollowedBy ((\(a,_,_) -> a) <$> m r s) >>= \x -> return (x, s, mempty) {-# INLINE notFollowedBy #-} -instance (Parsing m, MonadPlus m, Monoid w, Show w, Show s) => Parsing (Strict.RWST r w s m) where+instance (Parsing m, MonadPlus m, Monoid w) => Parsing (Strict.RWST r w s m) where try (Strict.RWST m) = Strict.RWST $ \r s -> try (m r s) {-# INLINE try #-} Strict.RWST m <?> l = Strict.RWST $ \r s -> m r s <?> l@@ -367,7 +367,7 @@ eof = lift eof {-# INLINE eof #-} notFollowedBy (Strict.RWST m) = Strict.RWST- $ \r s -> notFollowedBy (m r s) >>= \x -> return (x, s, mempty)+ $ \r s -> notFollowedBy ((\(a,_,_) -> a) <$> m r s) >>= \x -> return (x, s, mempty) {-# INLINE notFollowedBy #-} instance (Parsing m, Monad m) => Parsing (IdentityT m) where
src/Text/Parser/LookAhead.hs view
@@ -46,11 +46,11 @@ -- | @lookAhead p@ parses @p@ without consuming any input. lookAhead :: m a -> m a -instance (LookAheadParsing m, MonadPlus m, Show s) => LookAheadParsing (Lazy.StateT s m) where+instance (LookAheadParsing m, MonadPlus m) => LookAheadParsing (Lazy.StateT s m) where lookAhead (Lazy.StateT m) = Lazy.StateT $ lookAhead . m {-# INLINE lookAhead #-} -instance (LookAheadParsing m, MonadPlus m, Show s) => LookAheadParsing (Strict.StateT s m) where+instance (LookAheadParsing m, MonadPlus m) => LookAheadParsing (Strict.StateT s m) where lookAhead (Strict.StateT m) = Strict.StateT $ lookAhead . m {-# INLINE lookAhead #-} @@ -58,19 +58,19 @@ lookAhead (ReaderT m) = ReaderT $ lookAhead . m {-# INLINE lookAhead #-} -instance (LookAheadParsing m, MonadPlus m, Monoid w, Show w) => LookAheadParsing (Strict.WriterT w m) where+instance (LookAheadParsing m, MonadPlus m, Monoid w) => LookAheadParsing (Strict.WriterT w m) where lookAhead (Strict.WriterT m) = Strict.WriterT $ lookAhead m {-# INLINE lookAhead #-} -instance (LookAheadParsing m, MonadPlus m, Monoid w, Show w) => LookAheadParsing (Lazy.WriterT w m) where+instance (LookAheadParsing m, MonadPlus m, Monoid w) => LookAheadParsing (Lazy.WriterT w m) where lookAhead (Lazy.WriterT m) = Lazy.WriterT $ lookAhead m {-# INLINE lookAhead #-} -instance (LookAheadParsing m, MonadPlus m, Monoid w, Show w, Show s) => LookAheadParsing (Lazy.RWST r w s m) where+instance (LookAheadParsing m, MonadPlus m, Monoid w) => LookAheadParsing (Lazy.RWST r w s m) where lookAhead (Lazy.RWST m) = Lazy.RWST $ \r s -> lookAhead (m r s) {-# INLINE lookAhead #-} -instance (LookAheadParsing m, MonadPlus m, Monoid w, Show w, Show s) => LookAheadParsing (Strict.RWST r w s m) where+instance (LookAheadParsing m, MonadPlus m, Monoid w) => LookAheadParsing (Strict.RWST r w s m) where lookAhead (Strict.RWST m) = Strict.RWST $ \r s -> lookAhead (m r s) {-# INLINE lookAhead #-}
src/Text/Parser/Token.hs view
@@ -344,7 +344,7 @@ token :: m a -> m a token p = p <* (someSpace <|> pure ()) -instance (TokenParsing m, MonadPlus m, Show s) => TokenParsing (Lazy.StateT s m) where+instance (TokenParsing m, MonadPlus m) => TokenParsing (Lazy.StateT s m) where nesting (Lazy.StateT m) = Lazy.StateT $ nesting . m {-# INLINE nesting #-} someSpace = lift someSpace@@ -354,7 +354,7 @@ highlight h (Lazy.StateT m) = Lazy.StateT $ highlight h . m {-# INLINE highlight #-} -instance (TokenParsing m, MonadPlus m, Show s) => TokenParsing (Strict.StateT s m) where+instance (TokenParsing m, MonadPlus m) => TokenParsing (Strict.StateT s m) where nesting (Strict.StateT m) = Strict.StateT $ nesting . m {-# INLINE nesting #-} someSpace = lift someSpace@@ -374,7 +374,7 @@ highlight h (ReaderT m) = ReaderT $ highlight h . m {-# INLINE highlight #-} -instance (TokenParsing m, MonadPlus m, Monoid w, Show w) => TokenParsing (Strict.WriterT w m) where+instance (TokenParsing m, MonadPlus m, Monoid w) => TokenParsing (Strict.WriterT w m) where nesting (Strict.WriterT m) = Strict.WriterT $ nesting m {-# INLINE nesting #-} someSpace = lift someSpace@@ -384,7 +384,7 @@ highlight h (Strict.WriterT m) = Strict.WriterT $ highlight h m {-# INLINE highlight #-} -instance (TokenParsing m, MonadPlus m, Monoid w, Show w) => TokenParsing (Lazy.WriterT w m) where+instance (TokenParsing m, MonadPlus m, Monoid w) => TokenParsing (Lazy.WriterT w m) where nesting (Lazy.WriterT m) = Lazy.WriterT $ nesting m {-# INLINE nesting #-} someSpace = lift someSpace@@ -394,7 +394,7 @@ highlight h (Lazy.WriterT m) = Lazy.WriterT $ highlight h m {-# INLINE highlight #-} -instance (TokenParsing m, MonadPlus m, Monoid w, Show w, Show s) => TokenParsing (Lazy.RWST r w s m) where+instance (TokenParsing m, MonadPlus m, Monoid w) => TokenParsing (Lazy.RWST r w s m) where nesting (Lazy.RWST m) = Lazy.RWST $ \r s -> nesting (m r s) {-# INLINE nesting #-} someSpace = lift someSpace@@ -404,7 +404,7 @@ highlight h (Lazy.RWST m) = Lazy.RWST $ \r s -> highlight h (m r s) {-# INLINE highlight #-} -instance (TokenParsing m, MonadPlus m, Monoid w, Show w, Show s) => TokenParsing (Strict.RWST r w s m) where+instance (TokenParsing m, MonadPlus m, Monoid w) => TokenParsing (Strict.RWST r w s m) where nesting (Strict.RWST m) = Strict.RWST $ \r s -> nesting (m r s) {-# INLINE nesting #-} someSpace = lift someSpace
tests/QuickCheck.hs view
@@ -24,6 +24,8 @@ import Text.Parser.Combinators import Text.ParserCombinators.ReadP (readP_to_S) +import System.Exit+ -- -------------------------------------------------------------------------- -- -- Run tests with different parser frameworks @@ -50,7 +52,12 @@ -- Main main :: IO ()-main = mapM_ quickCheck tests+main = mapM quickCheckResult tests >>= \x -> case filter (not . passed) x of+ [] -> exitSuccess+ _ -> exitFailure+ where+ passed Success{} = True+ passed _ = False -- -------------------------------------------------------------------------- -- -- Tests