parser-combinators 1.0.0 → 1.0.1
raw patch · 9 files changed
+36/−34 lines, 9 files
Files
- CHANGELOG.md +4/−0
- Control/Applicative/Combinators.hs +1/−3
- Control/Applicative/Combinators/NonEmpty.hs +1/−1
- Control/Applicative/Permutations.hs +1/−1
- Control/Monad/Combinators.hs +18/−19
- Control/Monad/Combinators/Expr.hs +1/−1
- Control/Monad/Combinators/NonEmpty.hs +6/−6
- README.md +1/−1
- parser-combinators.cabal +3/−2
CHANGELOG.md view
@@ -1,3 +1,7 @@+## Parser combinators 1.0.1++* Cosmetic changes in the source code.+ ## Parser combinators 1.0.0 * Added the `Control.Monad.Combinators.Expr` module.
Control/Applicative/Combinators.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Control.Applicative.Combinators--- Copyright : © 2017–2018 Mark Karpov+-- Copyright : © 2017–2019 Mark Karpov -- License : BSD 3 clause -- -- Maintainer : Mark Karpov <markkarpov92@gmail.com>@@ -85,8 +85,6 @@ #if MIN_VERSION_base(4,9,0) import Control.Monad (replicateM, replicateM_)-#elif !MIN_VERSION_base(4,8,0)-import Data.Traversable (sequenceA) #endif ----------------------------------------------------------------------------
Control/Applicative/Combinators/NonEmpty.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Control.Applicative.Combinators--- Copyright : © 2017–2018 Mark Karpov+-- Copyright : © 2017–2019 Mark Karpov -- License : BSD 3 clause -- -- Maintainer : Mark Karpov <markkarpov92@gmail.com>
Control/Applicative/Permutations.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Control.Applicative.Permutations--- Copyright : © 2017–2018 Mark Karpov+-- Copyright : © 2017–2019 Alex Washburn -- License : BSD 3 clause -- -- Maintainer : Mark Karpov <markkarpov92@gmail.com>
Control/Monad/Combinators.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Control.Monad.Combinators--- Copyright : © 2017–2018 Mark Karpov+-- Copyright : © 2017–2019 Mark Karpov -- License : BSD 3 clause -- -- Maintainer : Mark Karpov <markkarpov92@gmail.com>@@ -17,7 +17,6 @@ -- @since 0.4.0 {-# LANGUAGE BangPatterns #-}-{-# LANGUAGE CPP #-} module Control.Monad.Combinators ( -- * Re-exports from "Control.Applicative"@@ -88,11 +87,11 @@ -- See also: 'skipCount', 'count''. count :: Monad m => Int -> m a -> m [a]-count n' p = liftM ($ []) (go id n')+count n' p = go id n' where go f !n = if n <= 0- then return f+ then return (f []) else do x <- p go (f . (x:)) (n - 1)@@ -110,7 +109,7 @@ count' :: MonadPlus m => Int -> Int -> m a -> m [a] count' m' n' p = if n' > 0 && n' >= m'- then liftM ($ []) (gom id m')+ then gom id m' else return [] where gom f !m =@@ -124,9 +123,9 @@ then do r <- optional p case r of- Nothing -> return f+ Nothing -> return (f []) Just x -> god (f . (x:)) (d - 1)- else return f+ else return (f []) {-# INLINE count' #-} -- | @'endBy' p sep@ parses /zero/ or more occurrences of @p@, separated and@@ -151,12 +150,12 @@ -- > identifier = (:) <$> letter <*> many (alphaNumChar <|> char '_') many :: MonadPlus m => m a -> m [a]-many p = liftM ($ []) (go id)+many p = go id where go f = do r <- optional p case r of- Nothing -> return f+ Nothing -> return (f []) Just x -> go (f . (x:)) {-# INLINE many #-} @@ -166,12 +165,12 @@ -- See also: 'skipMany', 'skipManyTill'. manyTill :: MonadPlus m => m a -> m end -> m [a]-manyTill p end = liftM ($ []) (go id)+manyTill p end = go id where go f = do done <- option False (re True end) if done- then return f+ then return (f []) else do x <- p go (f . (x:))@@ -205,7 +204,7 @@ r <- optional p case r of Nothing -> return []- Just x -> liftM (x:) (many (sep >> p))+ Just x -> (x:) <$> many (sep >> p) {-# INLINE sepBy #-} -- | @'sepBy1' p sep@ parses /one/ or more occurrences of @p@, separated by@@ -214,24 +213,24 @@ sepBy1 :: MonadPlus m => m a -> m sep -> m [a] sepBy1 p sep = do x <- p- liftM (x:) (many (sep >> p))+ (x:) <$> many (sep >> p) {-# INLINE sepBy1 #-} -- | @'sepEndBy' p sep@ parses /zero/ or more occurrences of @p@, separated -- and optionally ended by @sep@. Returns a list of values returned by @p@. sepEndBy :: MonadPlus m => m a -> m sep -> m [a]-sepEndBy p sep = liftM ($ []) (go id)+sepEndBy p sep = go id where go f = do r <- optional p case r of- Nothing -> return f+ Nothing -> return (f []) Just x -> do more <- option False (re True sep) if more then go (f . (x:))- else return (f . (x:))+ else return (f [x]) {-# INLINE sepEndBy #-} -- | @'sepEndBy1' p sep@ parses /one/ or more occurrences of @p@, separated@@ -242,7 +241,7 @@ x <- p more <- option False (re True sep) if more- then liftM (x:) (sepEndBy p sep)+ then (x:) <$> sepEndBy p sep else return [x] {-# INLINE sepEndBy1 #-} @@ -312,7 +311,7 @@ -- Compat helpers (for older GHCs) re :: Monad m => a -> m b -> m a-re x = liftM (const x)+re x = fmap (const x) {-# INLINE re #-} option :: MonadPlus m => a -> m a -> m a@@ -320,5 +319,5 @@ {-# INLINE option #-} optional :: MonadPlus m => m a -> m (Maybe a)-optional p = liftM Just p `mplus` return Nothing+optional p = fmap Just p `mplus` return Nothing {-# INLINE optional #-}
Control/Monad/Combinators/Expr.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Control.Monad.Combinators.Expr--- Copyright : © 2017–2018 Mark Karpov+-- Copyright : © 2017–2019 Mark Karpov -- License : BSD 3 clause -- -- Maintainer : Mark Karpov <markkarpov92@gmail.com>
Control/Monad/Combinators/NonEmpty.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Control.Monad.Combinators.NonEmpty--- Copyright : © 2017–2018 Mark Karpov+-- Copyright : © 2017–2019 Mark Karpov -- License : BSD 3 clause -- -- Maintainer : Mark Karpov <markkarpov92@gmail.com>@@ -31,14 +31,14 @@ -- > word = some letter some :: MonadPlus m => m a -> m (NonEmpty a)-some p = liftM NE.fromList (C.some p)+some p = NE.fromList <$> C.some p {-# INLINE some #-} -- | @'endBy1' p sep@ parses /one/ or more occurrences of @p@, separated and -- ended by @sep@. Returns a non-empty list of values returned by @p@. endBy1 :: MonadPlus m => m a -> m sep -> m (NonEmpty a)-endBy1 p sep = liftM NE.fromList (C.endBy1 p sep)+endBy1 p sep = NE.fromList <$> C.endBy1 p sep {-# INLINE endBy1 #-} -- | @'someTill' p end@ works similarly to @'C.manyTill' p end@, but @p@@@ -47,14 +47,14 @@ -- See also: 'C.skipSome', 'C.skipSomeTill'. someTill :: MonadPlus m => m a -> m end -> m (NonEmpty a)-someTill p end = liftM NE.fromList (C.someTill p end)+someTill p end = NE.fromList <$> C.someTill p end {-# INLINE someTill #-} -- | @'sepBy1' p sep@ parses /one/ or more occurrences of @p@, separated by -- @sep@. Returns a non-empty list of values returned by @p@. sepBy1 :: MonadPlus m => m a -> m sep -> m (NonEmpty a)-sepBy1 p sep = liftM NE.fromList (C.sepBy1 p sep)+sepBy1 p sep = NE.fromList <$> C.sepBy1 p sep {-# INLINE sepBy1 #-} -- | @'sepEndBy1' p sep@ parses /one/ or more occurrences of @p@, separated@@ -62,5 +62,5 @@ -- @p@. sepEndBy1 :: MonadPlus m => m a -> m sep -> m (NonEmpty a)-sepEndBy1 p sep = liftM NE.fromList (C.sepEndBy1 p sep)+sepEndBy1 p sep = NE.fromList <$> C.sepEndBy1 p sep {-# INLINE sepEndBy1 #-}
README.md view
@@ -21,6 +21,6 @@ ## License -Copyright © 2017–2018 Mark Karpov+Copyright © 2017–2019 Mark Karpov Distributed under BSD 3 clause license.
parser-combinators.cabal view
@@ -1,10 +1,11 @@ name: parser-combinators-version: 1.0.0+version: 1.0.1 cabal-version: 1.18-tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.2+tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.3 license: BSD3 license-file: LICENSE.md author: Mark Karpov <markkarpov92@gmail.com>+ Alex Washburn <github@recursion.ninja> maintainer: Mark Karpov <markkarpov92@gmail.com> homepage: https://github.com/mrkkrp/parser-combinators bug-reports: https://github.com/mrkkrp/parser-combinators/issues