parsec 3.1.13.0 → 3.1.14.0
raw patch · 11 files changed
+87/−24 lines, 11 filesdep ~basedep ~bytestringdep ~semigroups
Dependency ranges changed: base, bytestring, semigroups, text
Files
- ChangeLog.md +8/−0
- parsec.cabal +13/−10
- src/Text/Parsec/ByteString.hs +1/−1
- src/Text/Parsec/ByteString/Lazy.hs +2/−1
- src/Text/Parsec/Char.hs +9/−4
- src/Text/Parsec/Perm.hs +6/−0
- src/Text/Parsec/Prim.hs +2/−0
- src/Text/Parsec/String.hs +1/−1
- src/Text/Parsec/Text.hs +20/−1
- src/Text/Parsec/Text/Lazy.hs +20/−1
- src/Text/Parsec/Token.hs +5/−5
ChangeLog.md view
@@ -1,3 +1,11 @@+### 3.1.14.0++- Add `parseFromFile` to `Text.Parsec.Text.Lazy` and `Text.Parsec.Text` (#103, #104).++- Clarify Haddock documentation in various places (#105,#101,#102).++- Add support for `base-4.13`.+ ### 3.1.13.0 - Add official support for [`SafeHaskell`](http://downloads.haskell.org/~ghc/latest/docs/html/users_guide/safe_haskell.html)
parsec.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.12 name: parsec-version: 3.1.13.0+version: 3.1.14.0 synopsis: Monadic parser combinators description: Parsec is designed from scratch as an industrial-strength parser@@ -21,18 +21,18 @@ license-file: LICENSE author: Daan Leijen <daan@microsoft.com>, Paolo Martini <paolo@nemail.it>, Antoine Latter <aslatter@gmail.com> maintainer: Herbert Valerio Riedel <hvr@gnu.org>-homepage: https://github.com/hvr/parsec-bug-reports: https://github.com/hvr/parsec/issues+homepage: https://github.com/haskell/parsec+bug-reports: https://github.com/haskell/parsec/issues category: Parsing build-type: Simple-tested-with: GHC ==8.4.1 || ==8.2.2 || ==8.0.2 || ==7.10.3 || ==7.8.4 || ==7.6.3 || ==7.4.2+tested-with: GHC ==8.6.1 || ==8.4.3 || ==8.2.2 || ==8.0.2 || ==7.10.3 || ==7.8.4 || ==7.6.3 || ==7.4.2 || ==7.4.1 extra-source-files: ChangeLog.md, README.md source-repository head type: git- location: https://github.com/hvr/parsec+ location: https://github.com/haskell/parsec library hs-source-dirs: src@@ -64,10 +64,11 @@ Text.ParserCombinators.Parsec.Token build-depends:- base >= 4.5.1 && < 4.12,+ base >= 4.5.0 && < 4.14, mtl >= 1.1.1 && < 2.3, bytestring >= 0.9.2.1 && < 0.11,- text >= 0.11.3 && < 1.3+ text (>= 0.11.3.1 && < 0.12)+ || (>= 1.0.0.0 && < 1.3) default-language: Haskell2010 other-extensions:@@ -86,10 +87,12 @@ ghc-options: -Wall if impl(ghc >= 8.0)- ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -Wno-trustworthy-safe+ ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wno-trustworthy-safe+ if impl(ghc < 8.8)+ ghc-options: -Wnoncanonical-monadfail-instances else -- provide/emulate `Control.Monad.Fail` and `Semigroup` API for pre-GHC8- build-depends: fail == 4.9.*, semigroups == 0.18.*+ build-depends: fail == 4.9.*, semigroups >= 0.18 && < 0.20 if impl(ghc >= 7.10) ghc-options: -fno-warn-trustworthy-safe@@ -124,4 +127,4 @@ if impl(ghc >= 8.0) ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances else- build-depends: semigroups == 0.18.*+ build-depends: semigroups
src/Text/Parsec/ByteString.hs view
@@ -36,7 +36,7 @@ -- > Right xs -> print (sum xs) -- > } -parseFromFile :: Parser a -> String -> IO (Either ParseError a)+parseFromFile :: Parser a -> FilePath -> IO (Either ParseError a) parseFromFile p fname = do input <- C.readFile fname return (runP p () fname input)
src/Text/Parsec/ByteString/Lazy.hs view
@@ -35,7 +35,8 @@ -- > Left err -> print err -- > Right xs -> print (sum xs) -- > }-parseFromFile :: Parser a -> String -> IO (Either ParseError a)++parseFromFile :: Parser a -> FilePath -> IO (Either ParseError a) parseFromFile p fname = do input <- C.readFile fname return (runP p () fname input)
src/Text/Parsec/Char.hs view
@@ -89,19 +89,24 @@ lower :: (Stream s m Char) => ParsecT s u m Char lower = satisfy isLower <?> "lowercase letter" --- | Parses a letter or digit (a character between \'0\' and \'9\')+-- | Parses a alphabetic or numeric Unicode characters -- according to 'isAlphaNum'. Returns the parsed character.+--+-- Note that numeric digits outside the ASCII range (such as arabic-indic digits like e.g. \"٤\" or @U+0664@),+-- as well as numeric characters which aren't digits, are parsed by this function+-- but not by 'digit'. alphaNum :: (Stream s m Char => ParsecT s u m Char) alphaNum = satisfy isAlphaNum <?> "letter or digit" --- | Parses a letter (an upper case or lower case character according--- to 'isAlpha'). Returns the parsed character.+-- | Parses an alphabetic Unicode characters (lower-case, upper-case and title-case letters,+-- plus letters of caseless scripts and modifiers letters according to 'isAlpha').+-- Returns the parsed character. letter :: (Stream s m Char) => ParsecT s u m Char letter = satisfy isAlpha <?> "letter" --- | Parses a digit. Returns the parsed character.+-- | Parses an ASCII digit. Returns the parsed character. digit :: (Stream s m Char) => ParsecT s u m Char digit = satisfy isDigit <?> "digit"
src/Text/Parsec/Perm.hs view
@@ -23,6 +23,12 @@ -- by Arthur Baars, Andres Loh and Doaitse Swierstra. -- Published as a functional pearl at the Haskell Workshop 2001. --+-- From the abstract: +--+-- A permutation phrase is a sequence of elements (possibly of different types) +-- in which each element occurs exactly once and the order is irrelevant. +-- Some of the permutable elements may be optional.+-- -----------------------------------------------------------------------------
src/Text/Parsec/Prim.hs view
@@ -271,7 +271,9 @@ return = Applicative.pure p >>= f = parserBind p f (>>) = (Applicative.*>)+#if !MIN_VERSION_base(4,13,0) fail = Fail.fail+#endif -- | @since 3.1.12.0 instance Fail.MonadFail (ParsecT s u m) where
src/Text/Parsec/String.hs view
@@ -33,7 +33,7 @@ -- > Left err -> print err -- > Right xs -> print (sum xs) -- > }-parseFromFile :: Parser a -> String -> IO (Either ParseError a)+parseFromFile :: Parser a -> FilePath -> IO (Either ParseError a) parseFromFile p fname = do input <- readFile fname return (runP p () fname input)
src/Text/Parsec/Text.hs view
@@ -15,11 +15,30 @@ ----------------------------------------------------------------------------- module Text.Parsec.Text- ( Parser, GenParser+ ( Parser, GenParser, parseFromFile ) where import qualified Data.Text as Text import Text.Parsec.Prim+import Text.Parsec.Error+import Data.Text.IO as T type Parser = Parsec Text.Text () type GenParser st = Parsec Text.Text st++-- | @parseFromFile p filePath@ runs a strict text parser @p@ on the+-- input read from @filePath@ using 'Data.Text.IO.readFile'. Returns either a 'ParseError'+-- ('Left') or a value of type @a@ ('Right').+--+-- > main = do{ result <- parseFromFile numbers "digits.txt"+-- > ; case result of+-- > Left err -> print err+-- > Right xs -> print (sum xs)+-- > }+--+-- @since 3.1.14.0++parseFromFile :: Parser a -> FilePath -> IO (Either ParseError a)+parseFromFile p fname+ = do input <- T.readFile fname+ return (runP p () fname input)
src/Text/Parsec/Text/Lazy.hs view
@@ -15,11 +15,30 @@ ----------------------------------------------------------------------------- module Text.Parsec.Text.Lazy- ( Parser, GenParser+ ( Parser, GenParser, parseFromFile ) where import qualified Data.Text.Lazy as Text import Text.Parsec.Prim+import Text.Parsec.Error+import Data.Text.Lazy.IO as TL type Parser = Parsec Text.Text () type GenParser st = Parsec Text.Text st++-- | @parseFromFile p filePath@ runs a strict text parser @p@ on the+-- input read from @filePath@ using 'Data.Text.Lazy.IO.readFile'. Returns either a 'ParseError'+-- ('Left') or a value of type @a@ ('Right').+--+-- > main = do{ result <- parseFromFile numbers "digits.txt"+-- > ; case result of+-- > Left err -> print err+-- > Right xs -> print (sum xs)+-- > }+--+-- @since 3.1.14.0++parseFromFile :: Parser a -> FilePath -> IO (Either ParseError a)+parseFromFile p fname+ = do input <- TL.readFile fname+ return (runP p () fname input)
src/Text/Parsec/Token.hs view
@@ -201,19 +201,19 @@ naturalOrFloat :: ParsecT s u m (Either Integer Double), - -- | Parses a positive whole number in the decimal system. Returns the+ -- | Parses a non-negative whole number in the decimal system. Returns the -- value of the number. decimal :: ParsecT s u m Integer, - -- | Parses a positive whole number in the hexadecimal system. The number- -- should be prefixed with \"0x\" or \"0X\". Returns the value of the+ -- | Parses a non-negative whole number in the hexadecimal system. The+ -- number should be prefixed with \"x\" or \"X\". Returns the value of the -- number. hexadecimal :: ParsecT s u m Integer, - -- | Parses a positive whole number in the octal system. The number- -- should be prefixed with \"0o\" or \"0O\". Returns the value of the+ -- | Parses a non-negative whole number in the octal system. The number+ -- should be prefixed with \"o\" or \"O\". Returns the value of the -- number. octal :: ParsecT s u m Integer,