parsers 0.12.10 → 0.12.11
raw patch · 11 files changed
+55/−214 lines, 11 filesdep ~containersdep ~mtldep ~textPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: containers, mtl, text, transformers
API changes (from Hackage documentation)
- Text.Parser.Expression: instance GHC.Arr.Ix Text.Parser.Expression.Assoc
+ Text.Parser.Expression: instance GHC.Ix.Ix Text.Parser.Expression.Assoc
Files
- .hlint.yaml +7/−0
- .travis.yml +0/−181
- CHANGELOG.markdown +4/−0
- HLint.hs +0/−4
- README.markdown +1/−1
- parsers.cabal +12/−9
- src/Text/Parser/Char.hs +4/−3
- src/Text/Parser/Combinators.hs +21/−12
- src/Text/Parser/Permutation.hs +2/−2
- src/Text/Parser/Token.hs +1/−0
- src/Text/Parser/Token/Style.hs +3/−2
+ .hlint.yaml view
@@ -0,0 +1,7 @@+- arguments: [-XCPP, --cpp-define=HLINT, --cpp-ansi]++- ignore: {name: Reduce duplication}+- ignore: {name: Use String}+# Needed for backwards compatibility with old versions of base, where+# replicateM had a Monad constraint instead of an Applicative one.+- ignore: {name: Use replicateM, within: [Text.Parser.Combinators]}
− .travis.yml
@@ -1,181 +0,0 @@-# This Travis job script has been generated by a script via-#-# haskell-ci '--output=.travis.yml' '--config=cabal.haskell-ci' 'cabal.project'-#-# For more information, see https://github.com/haskell-CI/haskell-ci-#-# version: 0.3.20190425-#-language: c-dist: xenial-git:- # whether to recursively clone submodules- submodules: false-notifications:- irc:- channels:- - irc.freenode.org#haskell-lens- skip_join: true- template:- - "\"\\x0313parsers\\x03/\\x0306%{branch}\\x03 \\x0314%{commit}\\x03 %{build_url} %{message}\""-cache:- directories:- - $HOME/.cabal/packages- - $HOME/.cabal/store-before_cache:- - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log- # remove files that are regenerated by 'cabal update'- - rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*- - rm -fv $CABALHOME/packages/hackage.haskell.org/*.json- - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache- - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar- - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx- - rm -rfv $CABALHOME/packages/head.hackage-matrix:- include:- - compiler: ghc-8.8.1- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}}- env: GHCHEAD=true- - compiler: ghc-8.6.5- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-2.4"]}}- - compiler: ghc-8.4.4- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-2.4"]}}- - compiler: ghc-8.2.2- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-2.4"]}}- - compiler: ghc-8.0.2- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-2.4"]}}- - compiler: ghc-7.10.3- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.10.3","cabal-install-2.4"]}}- - compiler: ghc-7.8.4- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.8.4","cabal-install-2.4"]}}- - compiler: ghc-7.6.3- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.6.3","cabal-install-2.4"]}}- - compiler: ghc-7.4.2- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.4.2","cabal-install-2.4"]}}- - compiler: ghc-7.2.2- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.2.2","cabal-install-2.4"]}}- - compiler: ghc-7.0.4- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.0.4","cabal-install-2.4"]}}- - compiler: ghc-head- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-head","cabal-install-head"]}}- env: GHCHEAD=true- allow_failures:- - compiler: ghc-head- - compiler: ghc-7.0.4- - compiler: ghc-7.2.2- - compiler: ghc-8.8.1-before_install:- - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')- - HCPKG="$HC-pkg"- - unset CC- - CABAL=/opt/ghc/bin/cabal- - CABALHOME=$HOME/.cabal- - export PATH="$CABALHOME/bin:$PATH"- - TOP=$(pwd)- - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))- - echo $HCNUMVER- - CABAL="$CABAL -vnormal+nowrap+markoutput"- - set -o pipefail- - |- echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk- echo 'BEGIN { state = "output"; }' >> .colorful.awk- echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk- echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk- echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk- echo ' if (state == "cabal") {' >> .colorful.awk- echo ' print blue($0)' >> .colorful.awk- echo ' } else {' >> .colorful.awk- echo ' print $0' >> .colorful.awk- echo ' }' >> .colorful.awk- echo '}' >> .colorful.awk- - cat .colorful.awk- - |- color_cabal_output () {- awk -f $TOP/.colorful.awk- }- - echo text | color_cabal_output-install:- - ${CABAL} --version- - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"- - TEST=--enable-tests- - BENCH=--enable-benchmarks- - GHCHEAD=${GHCHEAD-false}- - rm -f $CABALHOME/config- - |- echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config- echo "remote-build-reporting: anonymous" >> $CABALHOME/config- echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config- echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config- echo "world-file: $CABALHOME/world" >> $CABALHOME/config- echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config- echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config- echo "installdir: $CABALHOME/bin" >> $CABALHOME/config- echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config- echo "store-dir: $CABALHOME/store" >> $CABALHOME/config- echo "install-dirs user" >> $CABALHOME/config- echo " prefix: $CABALHOME" >> $CABALHOME/config- echo "repository hackage.haskell.org" >> $CABALHOME/config- echo " url: http://hackage.haskell.org/" >> $CABALHOME/config- - |- if $GHCHEAD; then- echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1/g')" >> $CABALHOME/config- - echo "repository head.hackage" >> $CABALHOME/config- echo " url: http://head.hackage.haskell.org/" >> $CABALHOME/config- echo " secure: True" >> $CABALHOME/config- echo " root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740" >> $CABALHOME/config- echo " 2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb" >> $CABALHOME/config- echo " 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e" >> $CABALHOME/config- echo " key-threshold: 3" >> $CABALHOME/config- fi- - cat $CABALHOME/config- - rm -fv cabal.project cabal.project.local cabal.project.freeze- - travis_retry ${CABAL} v2-update -v- - if [ $HCNUMVER -eq 80801 ] ; then ${CABAL} v2-install -w ${HC} -j2 hlint --constraint='hlint ==2.1.*' | color_cabal_output ; fi- # Generate cabal.project- - rm -rf cabal.project cabal.project.local cabal.project.freeze- - touch cabal.project- - |- echo 'packages: "."' >> cabal.project- - |- echo "write-ghc-environment-files: always" >> cabal.project- - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(parsers)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"- - cat cabal.project || true- - cat cabal.project.local || true- - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi- - ${CABAL} v2-freeze -w ${HC} ${TEST} ${BENCH} | color_cabal_output- - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"- - rm cabal.project.freeze- - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all | color_cabal_output-script:- - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)- # Packaging...- - ${CABAL} v2-sdist all | color_cabal_output- # Unpacking...- - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/- - cd ${DISTDIR} || false- - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;- # Generate cabal.project- - rm -rf cabal.project cabal.project.local cabal.project.freeze- - touch cabal.project- - |- echo 'packages: "parsers-*/*.cabal"' >> cabal.project- - |- echo "write-ghc-environment-files: always" >> cabal.project- - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(parsers)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"- - cat cabal.project || true- - cat cabal.project.local || true- # Building with tests and benchmarks...- # build & run tests, build benchmarks- - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} all | color_cabal_output- # Testing...- - ${CABAL} v2-test -w ${HC} ${TEST} ${BENCH} all | color_cabal_output- # HLint..- - if [ $HCNUMVER -eq 80801 ] ; then (cd parsers-* && hlint --cpp-ansi --cpp-define=HLINT src) ; fi- # cabal check...- - (cd parsers-* && ${CABAL} -vnormal check)- # haddock...- - ${CABAL} v2-haddock -w ${HC} ${TEST} ${BENCH} all | color_cabal_output--# REGENDATA ["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"]-# EOF
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+0.12.11 [2022.05.07]+--------------------+* Allow building with `transformers-0.6.*` and `mtl-2.3.*`.+ 0.12.10 [2019.05.02] -------------------- * Make the `parsec` and `attoparsec` dependencies optional with the use of
− HLint.hs
@@ -1,4 +0,0 @@-import "hint" HLint.Default--ignore "Reduce duplication"-ignore "Use String"
README.markdown view
@@ -1,7 +1,7 @@ parsers ======= -[](https://hackage.haskell.org/package/parsers) [](http://travis-ci.org/ekmett/parsers)+[](https://hackage.haskell.org/package/parsers) [](https://github.com/ekmett/parsers/actions?query=workflow%3AHaskell-CI) Goals -----
parsers.cabal view
@@ -1,6 +1,6 @@ name: parsers category: Text, Parsing-version: 0.12.10+version: 0.12.11 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE@@ -28,13 +28,15 @@ , GHC==8.2.2 , GHC==8.4.4 , GHC==8.6.5- , GHC==8.8.1+ , GHC==8.8.4+ , GHC==8.10.7+ , GHC==9.0.2+ , GHC==9.2.2 extra-source-files:- .travis.yml+ .hlint.yaml CHANGELOG.markdown README.markdown- HLint.hs source-repository head type: git@@ -80,10 +82,9 @@ base-orphans >= 0.3 && < 1, charset >= 0.3 && < 1, containers >= 0.4 && < 0.7,- semigroups >= 0.12 && < 1,- text >= 0.10 && < 1.3,- transformers >= 0.2 && < 0.6,- mtl >= 2.0.1 && < 2.3,+ text >= 0.10 && < 2.1,+ transformers >= 0.2 && < 0.7,+ mtl >= 2.0.1 && < 2.4, scientific >= 0.3 && < 0.4, unordered-containers >= 0.2 && < 0.3 @@ -92,7 +93,9 @@ if flag(parsec) build-depends: parsec >= 3.1 && < 3.2 if flag(attoparsec)- build-depends: attoparsec >= 0.12.1.4 && < 0.14+ build-depends: attoparsec >= 0.12.1.4 && < 0.15+ if impl(ghc < 8.0)+ build-depends: semigroups >= 0.12 && < 1 test-suite quickcheck type: exitcode-stdio-1.0
src/Text/Parser/Char.hs view
@@ -8,7 +8,7 @@ #endif #ifdef USE_DEFAULT_SIGNATURES-{-# LANGUAGE DefaultSignatures, TypeFamilies #-}+{-# LANGUAGE DefaultSignatures, TypeFamilies, TypeOperators #-} #endif ----------------------------------------------------------------------------- -- |@@ -67,7 +67,8 @@ #if __GLASGOW_HASKELL__ < 710 import Data.Monoid #endif-import Data.Text+import qualified Data.Text as Text+import Data.Text (Text) import qualified Text.ParserCombinators.ReadP as ReadP import Text.Parser.Combinators @@ -230,7 +231,7 @@ -- > divOrMod = text "div" -- > <|> text "mod" text :: Text -> m Text- text t = t <$ string (unpack t)+ text t = t <$ string (Text.unpack t) {-# INLINE text #-} instance (CharParsing m, MonadPlus m) => CharParsing (Lazy.StateT s m) where
src/Text/Parser/Combinators.hs view
@@ -6,7 +6,7 @@ #endif #ifdef USE_DEFAULT_SIGNATURES-{-# LANGUAGE DefaultSignatures, TypeFamilies #-}+{-# LANGUAGE DefaultSignatures, TypeFamilies, TypeOperators #-} #endif #if !MIN_VERSION_base(4,6,0)@@ -61,7 +61,7 @@ ) where import Control.Applicative-import Control.Monad (MonadPlus(..))+import Control.Monad (MonadPlus(..), void) import Control.Monad.Trans.Class import Control.Monad.Trans.State.Lazy as Lazy import Control.Monad.Trans.State.Strict as Strict@@ -71,8 +71,9 @@ import Control.Monad.Trans.RWS.Strict as Strict import Control.Monad.Trans.Reader import Control.Monad.Trans.Identity-import Data.Foldable (asum)-import Data.List.NonEmpty+import qualified Data.Foldable as F+import qualified Data.List.NonEmpty as NonEmpty+import Data.List.NonEmpty (NonEmpty(..)) #if __GLASGOW_HASKELL__ < 710 import Data.Monoid #ifdef ORPHAN_ALTERNATIVE_READP@@ -88,7 +89,7 @@ #ifdef MIN_VERSION_attoparsec import qualified Data.Attoparsec.Types as Att import qualified Data.Attoparsec.Combinator as Att-#endif +#endif import qualified Text.ParserCombinators.ReadP as ReadP @@ -97,11 +98,15 @@ import qualified Data.Binary.Get as B #endif +#if MIN_VERSION_base(4,9,0)+import Control.Monad (replicateM)+#endif+ -- | @choice ps@ tries to apply the parsers in the list @ps@ in order, -- until one of them succeeds. Returns the value of the succeeding -- parser. choice :: Alternative m => [m a] -> m a-choice = asum+choice = F.asum {-# INLINE choice #-} -- | @option x p@ tries to apply parser @p@. If @p@ fails without@@ -117,7 +122,7 @@ -- It only fails if @p@ fails after consuming input. It discards the result -- of @p@. (Plays the role of parsec's optional, which conflicts with Applicative's optional) skipOptional :: Alternative m => m a -> m ()-skipOptional p = (() <$ p) <|> pure ()+skipOptional p = void p <|> pure () {-# INLINE skipOptional #-} -- | @between open close p@ parses @open@, followed by @p@ and @close@.@@ -145,7 +150,7 @@ -- | @sepBy1 p sep@ parses /one/ or more occurrences of @p@, separated -- by @sep@. Returns a list of values returned by @p@. sepBy1 :: Alternative m => m a -> m sep -> m [a]-sepBy1 p sep = toList <$> sepByNonEmpty p sep+sepBy1 p sep = F.toList <$> sepByNonEmpty p sep {-# INLINE sepBy1 #-} -- | @sepByNonEmpty p sep@ parses /one/ or more occurrences of @p@, separated@@ -158,7 +163,7 @@ -- separated and optionally ended by @sep@. Returns a list of values -- returned by @p@. sepEndBy1 :: Alternative m => m a -> m sep -> m [a]-sepEndBy1 p sep = toList <$> sepEndByNonEmpty p sep+sepEndBy1 p sep = F.toList <$> sepEndByNonEmpty p sep -- | @sepEndByNonEmpty p sep@ parses /one/ or more occurrences of @p@, -- separated and optionally ended by @sep@. Returns a non-empty list of values@@ -184,7 +189,7 @@ -- | @endByNonEmpty p sep@ parses /one/ or more occurrences of @p@, separated -- and ended by @sep@. Returns a non-empty list of values returned by @p@. endByNonEmpty :: Alternative m => m a -> m sep -> m (NonEmpty a)-endByNonEmpty p sep = some1 (p <* sep)+endByNonEmpty p sep = NonEmpty.some1 (p <* sep) {-# INLINE endByNonEmpty #-} -- | @endBy p sep@ parses /zero/ or more occurrences of @p@, separated@@ -199,8 +204,12 @@ -- equal to zero, the parser equals to @return []@. Returns a list of -- @n@ values returned by @p@. count :: Applicative m => Int -> m a -> m [a]+#if MIN_VERSION_base(4,9,0)+count = replicateM+#else count n p | n <= 0 = pure [] | otherwise = sequenceA (replicate n p)+#endif {-# INLINE count #-} -- | @chainr p op x@ parses /zero/ or more occurrences of @p@,@@ -280,7 +289,7 @@ -- | A version of many that discards its input. Specialized because it -- can often be implemented more cheaply. skipMany :: m a -> m ()- skipMany p = () <$ many p+ skipMany p = void (many p) {-# INLINE skipMany #-} -- | @skipSome p@ applies the parser @p@ /one/ or more times, skipping@@ -446,7 +455,7 @@ unexpected = fail eof = Att.endOfInput notFollowedBy p = optional p >>= maybe (pure ()) (unexpected . show)-#endif +#endif #ifdef MIN_VERSION_binary instance Parsing B.Get where
src/Text/Parser/Permutation.hs view
@@ -27,7 +27,7 @@ ) where import Control.Applicative-import Data.Foldable (asum)+import qualified Data.Foldable as F (asum) infixl 1 <||>, <|?> infixl 2 <$$>, <$?>@@ -119,7 +119,7 @@ -- transform a permutation tree into a normal parser permute :: forall m a. Alternative m => Permutation m a -> m a permute (Permutation def xs)- = asum (map branch xs ++ e)+ = F.asum (map branch xs ++ e) where e :: [m a] e = maybe [] (pure . pure) def
src/Text/Parser/Token.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE UndecidableInstances #-} #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-}+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns #-} #endif {-# OPTIONS_GHC -fspec-constr -fspec-constr-count=8 #-} -----------------------------------------------------------------------------
src/Text/Parser/Token/Style.hs view
@@ -41,6 +41,7 @@ ) where import Control.Applicative+import Control.Monad (void) import qualified Data.HashSet as HashSet import Data.HashSet (HashSet) #if __GLASGOW_HASKELL__ < 710@@ -122,7 +123,7 @@ multiLineComment = try (string startStyle) *> inComment inComment = if nestingStyle then inCommentMulti else inCommentSingle inCommentMulti- = () <$ try (string endStyle)+ = void (try (string endStyle)) <|> multiLineComment *> inCommentMulti <|> skipSome (noneOf startEnd) *> inCommentMulti <|> oneOf startEnd *> inCommentMulti@@ -132,7 +133,7 @@ inCommentSingle :: m () inCommentSingle- = () <$ try (string endStyle)+ = void (try (string endStyle)) <|> skipSome (noneOf startEnd) *> inCommentSingle <|> oneOf startEnd *> inCommentSingle <?> "end of comment"