packages feed

megaparsec 5.0.0 → 5.0.1

raw patch · 7 files changed

+88/−44 lines, 7 filesdep +deepseqdep ~QuickCheckdep ~basedep ~bytestringPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: deepseq

Dependency ranges changed: QuickCheck, base, bytestring, megaparsec, mtl, test-framework, text

API changes (from Hackage documentation)

+ Text.Megaparsec: infix 0 <?>
+ Text.Megaparsec: type family Token s :: *;
+ Text.Megaparsec: }
+ Text.Megaparsec.Error: instance (Control.DeepSeq.NFData t, Control.DeepSeq.NFData e) => Control.DeepSeq.NFData (Text.Megaparsec.Error.ParseError t e)
+ Text.Megaparsec.Error: instance (Data.Data.Data t, Data.Data.Data e, GHC.Classes.Ord t, GHC.Classes.Ord e) => Data.Data.Data (Text.Megaparsec.Error.ParseError t e)
+ Text.Megaparsec.Error: instance Control.DeepSeq.NFData Text.Megaparsec.Error.Dec
+ Text.Megaparsec.Error: instance Control.DeepSeq.NFData t => Control.DeepSeq.NFData (Text.Megaparsec.Error.ErrorItem t)
+ Text.Megaparsec.Error: instance GHC.Generics.Generic (Text.Megaparsec.Error.ErrorItem t)
+ Text.Megaparsec.Error: instance GHC.Generics.Generic (Text.Megaparsec.Error.ParseError t e)
+ Text.Megaparsec.Perm: infixl 1 <|?>
+ Text.Megaparsec.Perm: infixl 2 <$?>
+ Text.Megaparsec.Pos: instance Control.DeepSeq.NFData Text.Megaparsec.Pos.InvalidPosException
+ Text.Megaparsec.Pos: instance Control.DeepSeq.NFData Text.Megaparsec.Pos.Pos
+ Text.Megaparsec.Pos: instance Control.DeepSeq.NFData Text.Megaparsec.Pos.SourcePos
+ Text.Megaparsec.Pos: instance Data.Data.Data Text.Megaparsec.Pos.SourcePos
+ Text.Megaparsec.Pos: instance GHC.Generics.Generic Text.Megaparsec.Pos.InvalidPosException
+ Text.Megaparsec.Pos: instance GHC.Generics.Generic Text.Megaparsec.Pos.SourcePos
+ Text.Megaparsec.Prim: infix 0 <?>
+ Text.Megaparsec.Prim: instance Control.DeepSeq.NFData s => Control.DeepSeq.NFData (Text.Megaparsec.Prim.State s)
+ Text.Megaparsec.Prim: instance Data.Data.Data s => Data.Data.Data (Text.Megaparsec.Prim.State s)
+ Text.Megaparsec.Prim: instance GHC.Generics.Generic (Text.Megaparsec.Prim.State s)
+ Text.Megaparsec.Prim: type family Token s :: *;
+ Text.Megaparsec.Prim: }
- Text.Megaparsec: class Ord (Token s) => Stream s where type family Token s :: *
+ Text.Megaparsec: class Ord (Token s) => Stream s where type Token s :: * where {
- Text.Megaparsec.Prim: class Ord (Token s) => Stream s where type family Token s :: *
+ Text.Megaparsec.Prim: class Ord (Token s) => Stream s where type Token s :: * where {

Files

CHANGELOG.md view
@@ -1,3 +1,13 @@+## Megaparsec 5.0.1++* Derived `NFData` instances for `Pos`, `InvalidPosException`, `SourcePos`,+  `ErrorItem`, `Dec`, `ParseError`, and `State`.++* Derived `Data` instance for `ParseError`, `Data` and `Typeable` instances+  for `SourcePos` and `State`.++* Minor documentation improvements.+ ## Megaparsec 5.0.0  ### General changes@@ -44,6 +54,9 @@  * `unexpected` combinator now accepts argument of type `ErrorItem` instead   of plain `String`.++* General performance improvements and improvements in speed of some+  combinators, `manyTill` in particular.  ### Error messages 
README.md view
@@ -10,7 +10,7 @@ * [Features](#features)     * [Core features](#core-features)     * [Error messages](#error-messages)-    * [Alex/Happy support](#alex/happy-support)+    * [Alex and Happy support](#alex-and-happy-support)     * [Character parsing](#character-parsing)     * [Permutation parsing](#permutation-parsing)     * [Expression parsing](#expression-parsing)@@ -122,7 +122,7 @@ messages for indentation-sensitive parsing instead of plain “incorrect indentation” phrase. -### Alex/Happy support+### Alex and Happy support  Megaparsec works well with streams of tokens produced by tools like Alex/Happy. Megaparsec 5 adds `updatePos` method to `Stream` type class that
Text/Megaparsec/Error.hs view
@@ -14,6 +14,7 @@  {-# LANGUAGE CPP                #-} {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric      #-} {-# LANGUAGE FlexibleContexts   #-} {-# LANGUAGE FlexibleInstances  #-} @@ -28,6 +29,7 @@   , sourcePosStackPretty ) where +import Control.DeepSeq import Control.Monad.Catch import Data.Data (Data) import Data.Foldable (concat)@@ -36,6 +38,7 @@ import Data.Semigroup import Data.Set (Set) import Data.Typeable (Typeable)+import GHC.Generics import Prelude hiding (concat) import qualified Data.List.NonEmpty as NE import qualified Data.Set           as E@@ -55,8 +58,10 @@   = Tokens (NonEmpty t)      -- ^ Non-empty stream of tokens   | Label (NonEmpty Char)    -- ^ Label (cannot be empty)   | EndOfInput               -- ^ End of input-  deriving (Show, Read, Eq, Ord, Data, Typeable)+  deriving (Show, Read, Eq, Ord, Data, Typeable, Generic) +instance NFData t => NFData (ErrorItem t)+ -- | The type class defines how to represent information about various -- exceptional situations. Data types that are used as custom data component -- in 'ParseError' must be instances of this type class.@@ -88,9 +93,16 @@  data Dec   = DecFail String         -- ^ 'fail' has been used in parser monad-  | DecIndentation Ordering Pos Pos -- ^ Incorrect indentation error+  | DecIndentation Ordering Pos Pos+    -- ^ Incorrect indentation error: desired ordering between reference+    -- level and actual level, reference indentation level, actual+    -- indentation level   deriving (Show, Read, Eq, Ord, Data, Typeable) +instance NFData Dec where+  rnf (DecFail str) = rnf str+  rnf (DecIndentation ord ref act) = ord `seq` rnf ref `seq` rnf act+ instance ErrorComponent Dec where   representFail        = DecFail   representIndentation = DecIndentation@@ -114,7 +126,9 @@   , errorUnexpected :: Set (ErrorItem t)  -- ^ Unexpected items   , errorExpected   :: Set (ErrorItem t)  -- ^ Expected items   , errorCustom     :: Set e              -- ^ Associated data, if any-  } deriving (Show, Read, Eq, Typeable)+  } deriving (Show, Read, Eq, Data, Typeable, Generic)++instance (NFData t, NFData e) => NFData (ParseError t e)  instance (Ord t, Ord e) => Semigroup (ParseError t e) where   (<>) = mergeError
Text/Megaparsec/Lexer.hs view
@@ -81,7 +81,7 @@ -- -- @spaceChar@ is used to parse trivial space characters. You can use -- 'C.spaceChar' from "Text.Megaparsec.Char" for this purpose as well as--- your own parser (if you don't want automatically consume newlines, for+-- your own parser (if you don't want to automatically consume newlines, for -- example). -- -- @lineComment@ is used to parse line comments. You can use
Text/Megaparsec/Pos.hs view
@@ -11,9 +11,11 @@ -- and column number. List of such positions can be used to model stack of -- include files. -{-# LANGUAGE CPP                #-}-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE TupleSections      #-}+{-# LANGUAGE CPP                        #-}+{-# LANGUAGE DeriveDataTypeable         #-}+{-# LANGUAGE DeriveGeneric              #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE TupleSections              #-}  module Text.Megaparsec.Pos   ( -- * Abstract position@@ -31,10 +33,12 @@   , defaultTabWidth ) where +import Control.DeepSeq import Control.Monad.Catch import Data.Data (Data) import Data.Semigroup import Data.Typeable (Typeable)+import GHC.Generics import Unsafe.Coerce  #if !MIN_VERSION_base(4,8,0)@@ -52,7 +56,7 @@ -- @since 5.0.0  newtype Pos = Pos Word-  deriving (Show, Eq, Ord, Data, Typeable)+  deriving (Show, Eq, Ord, Data, Typeable, NFData)  -- | Construction of 'Pos' from an instance of 'Integral'. The function -- throws 'InvalidPosException' when given non-positive argument. Note that@@ -105,9 +109,10 @@ -- @since 5.0.0  data InvalidPosException = InvalidPosException-  deriving (Eq, Show, Data, Typeable)+  deriving (Eq, Show, Data, Typeable, Generic)  instance Exception InvalidPosException+instance NFData    InvalidPosException  ---------------------------------------------------------------------------- -- Source position@@ -121,14 +126,17 @@   { sourceName   :: FilePath -- ^ Name of source file   , sourceLine   :: !Pos     -- ^ Line number   , sourceColumn :: !Pos     -- ^ Column number-  } deriving (Show, Read, Eq, Ord)+  } deriving (Show, Read, Eq, Ord, Data, Typeable, Generic) +instance NFData SourcePos+ -- | Construct initial position (line 1, column 1) given name of source -- file.  initialPos :: String -> SourcePos initialPos n = SourcePos n u u   where u = unsafePos 1+{-# INLINE initialPos #-}  -- | Pretty-print a 'SourcePos'. --
Text/Megaparsec/Prim.hs view
@@ -13,6 +13,8 @@  {-# LANGUAGE BangPatterns               #-} {-# LANGUAGE CPP                        #-}+{-# LANGUAGE DeriveDataTypeable         #-}+{-# LANGUAGE DeriveGeneric              #-} {-# LANGUAGE FlexibleContexts           #-} {-# LANGUAGE FlexibleInstances          #-} {-# LANGUAGE FunctionalDependencies     #-}@@ -55,6 +57,7 @@   , parseTest ) where +import Control.DeepSeq import Control.Monad import Control.Monad.Cont.Class import Control.Monad.Error.Class@@ -63,12 +66,15 @@ import Control.Monad.State.Class hiding (state) import Control.Monad.Trans import Control.Monad.Trans.Identity+import Data.Data (Data) import Data.Foldable (foldl') import Data.List.NonEmpty (NonEmpty (..)) import Data.Monoid hiding ((<>)) import Data.Proxy import Data.Semigroup import Data.Set (Set)+import Data.Typeable (Typeable)+import GHC.Generics import Prelude hiding (all) import qualified Control.Applicative               as A import qualified Control.Monad.Fail                as Fail@@ -100,8 +106,10 @@   { stateInput    :: s   , statePos      :: NonEmpty SourcePos   , stateTabWidth :: Pos }-  deriving (Show, Eq)+  deriving (Show, Eq, Data, Typeable, Generic) +instance NFData s => NFData (State s)+ -- | All information available after parsing. This includes consumption of -- input, success (with returned value) or failure (with parse error), and -- parser state at the end of parsing.@@ -367,7 +375,7 @@ manyErr :: a manyErr = error $   "Text.Megaparsec.Prim.many: combinator 'many' is applied to a parser"-  ++ " that accepts an empty string."+  ++ " that may consume no input."  instance (ErrorComponent e, Stream s)     => Monad (ParsecT e s m) where
megaparsec.cabal view
@@ -27,7 +27,7 @@ -- POSSIBILITY OF SUCH DAMAGE.  name:                 megaparsec-version:              5.0.0+version:              5.0.1 cabal-version:        >= 1.10 license:              BSD2 license-file:         LICENSE.md@@ -56,14 +56,15 @@   default:            False  library-  build-depends:      base         >= 4.6 && < 5-                    , bytestring-                    , containers   >= 0.5 && < 0.6-                    , exceptions   >= 0.6 && < 0.9-                    , mtl          == 2.*+  build-depends:      base         >= 4.6   && < 5.0+                    , bytestring   >= 0.2   && < 0.11+                    , containers   >= 0.5   && < 0.6+                    , deepseq      >= 1.3   && < 1.5+                    , exceptions   >= 0.6   && < 0.9+                    , mtl          >= 2.0   && < 3.0                     , scientific   >= 0.3.1 && < 0.4-                    , text         >= 0.2-                    , transformers >= 0.4 && < 0.6+                    , text         >= 0.2   && < 1.3+                    , transformers >= 0.4   && < 0.6    if !impl(ghc >= 8.0)     -- packages providing modules that moved into base-4.9.0.0@@ -88,7 +89,7 @@                     , Text.Megaparsec.Text                     , Text.Megaparsec.Text.Lazy   if flag(dev)-    ghc-options:      -Wall+    ghc-options:      -Wall -Werror     if impl(ghc >= 8.0)       ghc-options:    -Wcompat       ghc-options:    -Wnoncanonical-monadfail-instances@@ -102,7 +103,7 @@   hs-source-dirs:     old-tests   type:               exitcode-stdio-1.0   if flag(dev)-    ghc-options:      -Wall+    ghc-options:      -Wall -Werror   else     ghc-options:      -O2 -Wall   other-modules:      Bugs@@ -112,10 +113,10 @@                     , Bugs.Bug35                     , Bugs.Bug39                     , Util-  build-depends:      base                 >= 4.6 && < 5+  build-depends:      base                 >= 4.6 && < 5.0                     , HUnit                >= 1.2 && < 1.4-                    , megaparsec           >= 5.0.0-                    , test-framework       >= 0.6 && < 1+                    , megaparsec           >= 5.0.1+                    , test-framework       >= 0.6 && < 1.0                     , test-framework-hunit >= 0.2 && < 0.4   default-language:   Haskell2010 @@ -124,7 +125,7 @@   hs-source-dirs:     tests   type:               exitcode-stdio-1.0   if flag(dev)-    ghc-options:      -Wall+    ghc-options:      -Wall -Werror   else     ghc-options:      -O2 -Wall   other-modules:      Char@@ -136,20 +137,20 @@                     , Pos                     , Prim                     , Util-  build-depends:      base           >= 4.6 && < 5-                    , HUnit          >= 1.2 && < 1.4-                    , QuickCheck     >= 2.8.2 && < 3-                    , bytestring-                    , containers     >= 0.5 && < 0.6-                    , exceptions     >= 0.6 && < 0.9-                    , megaparsec     >= 5.0.0-                    , mtl            == 2.*+  build-depends:      base           >= 4.6   && < 5.0+                    , HUnit          >= 1.2   && < 1.4+                    , QuickCheck     >= 2.8.2 && < 3.0+                    , bytestring     >= 0.2   && < 0.11+                    , containers     >= 0.5   && < 0.6+                    , exceptions     >= 0.6   && < 0.9+                    , megaparsec     >= 5.0.1+                    , mtl            >= 2.0   && < 3.0                     , scientific     >= 0.3.1 && < 0.4-                    , test-framework >= 0.6 && < 1+                    , test-framework >= 0.6   && < 1.0                     , test-framework-hunit       >= 0.3 && < 0.4                     , test-framework-quickcheck2 >= 0.3 && < 0.4-                    , text           >= 0.2-                    , transformers   >= 0.4 && < 0.6+                    , text           >= 0.2   && < 1.3+                    , transformers   >= 0.4   && < 0.6    if !impl(ghc >= 8.0)     -- packages providing modules that moved into base-4.9.0.0@@ -165,14 +166,14 @@   hs-source-dirs:     benchmarks   type:               exitcode-stdio-1.0   if flag(dev)-    ghc-options:      -O2 -Wall+    ghc-options:      -O2 -Wall -Werror   else     ghc-options:      -O2 -Wall-  build-depends:      base       >= 4.6 && < 5-                    , bytestring >= 0.10 && < 2+  build-depends:      base       >= 4.6  && < 5.0+                    , bytestring >= 0.10 && < 0.11                     , criterion  >= 0.6.2.1 && < 1.2-                    , megaparsec >= 5.0.0-                    , text       >= 0.2+                    , megaparsec >= 5.0.1+                    , text       >= 0.2  && < 1.3   default-language:   Haskell2010  source-repository head