megaparsec 9.7.0 → 9.7.1
raw patch · 10 files changed
+34/−40 lines, 10 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Text.Megaparsec.Error: instance (GHC.Show.Show s, GHC.Show.Show (Text.Megaparsec.Stream.Token s), GHC.Show.Show e, Text.Megaparsec.Error.ShowErrorComponent e, Text.Megaparsec.Stream.VisualStream s, Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable e) => GHC.Exception.Type.Exception (Text.Megaparsec.Error.ParseError s e)
+ Text.Megaparsec.Error: instance (GHC.Show.Show (Text.Megaparsec.Stream.Token s), GHC.Show.Show e, Text.Megaparsec.Error.ShowErrorComponent e, Text.Megaparsec.Stream.VisualStream s, Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable e) => GHC.Exception.Type.Exception (Text.Megaparsec.Error.ParseError s e)
- Text.Megaparsec: class (Stream s, MonadPlus m) => MonadParsec e s m | m -> e s
+ Text.Megaparsec: class (Stream s, MonadPlus m) => MonadParsec e s (m :: Type -> Type) | m -> e s
- Text.Megaparsec: data ParsecT e s m a
+ Text.Megaparsec: data ParsecT e s (m :: Type -> Type) a
- Text.Megaparsec.Byte: crlf :: forall e s m. (MonadParsec e s m, Token s ~ Word8) => m (Tokens s)
+ Text.Megaparsec.Byte: crlf :: (MonadParsec e s m, Token s ~ Word8) => m (Tokens s)
- Text.Megaparsec.Byte: eol :: forall e s m. (MonadParsec e s m, Token s ~ Word8) => m (Tokens s)
+ Text.Megaparsec.Byte: eol :: (MonadParsec e s m, Token s ~ Word8) => m (Tokens s)
- Text.Megaparsec.Byte.Lexer: binary :: forall e s m a. (MonadParsec e s m, Token s ~ Word8, Num a) => m a
+ Text.Megaparsec.Byte.Lexer: binary :: (MonadParsec e s m, Token s ~ Word8, Num a) => m a
- Text.Megaparsec.Byte.Lexer: decimal :: forall e s m a. (MonadParsec e s m, Token s ~ Word8, Num a) => m a
+ Text.Megaparsec.Byte.Lexer: decimal :: (MonadParsec e s m, Token s ~ Word8, Num a) => m a
- Text.Megaparsec.Byte.Lexer: hexadecimal :: forall e s m a. (MonadParsec e s m, Token s ~ Word8, Num a) => m a
+ Text.Megaparsec.Byte.Lexer: hexadecimal :: (MonadParsec e s m, Token s ~ Word8, Num a) => m a
- Text.Megaparsec.Byte.Lexer: octal :: forall e s m a. (MonadParsec e s m, Token s ~ Word8, Num a) => m a
+ Text.Megaparsec.Byte.Lexer: octal :: (MonadParsec e s m, Token s ~ Word8, Num a) => m a
- Text.Megaparsec.Byte.Lexer: scientific :: forall e s m. (MonadParsec e s m, Token s ~ Word8) => m Scientific
+ Text.Megaparsec.Byte.Lexer: scientific :: (MonadParsec e s m, Token s ~ Word8) => m Scientific
- Text.Megaparsec.Char: crlf :: forall e s m. (MonadParsec e s m, Token s ~ Char) => m (Tokens s)
+ Text.Megaparsec.Char: crlf :: (MonadParsec e s m, Token s ~ Char) => m (Tokens s)
- Text.Megaparsec.Char: eol :: forall e s m. (MonadParsec e s m, Token s ~ Char) => m (Tokens s)
+ Text.Megaparsec.Char: eol :: (MonadParsec e s m, Token s ~ Char) => m (Tokens s)
- Text.Megaparsec.Char.Lexer: IndentMany :: Maybe Pos -> ([b] -> m a) -> m b -> IndentOpt m a b
+ Text.Megaparsec.Char.Lexer: IndentMany :: Maybe Pos -> ([b] -> m a) -> m b -> IndentOpt (m :: Type -> Type) a b
- Text.Megaparsec.Char.Lexer: IndentNone :: a -> IndentOpt m a b
+ Text.Megaparsec.Char.Lexer: IndentNone :: a -> IndentOpt (m :: Type -> Type) a b
- Text.Megaparsec.Char.Lexer: IndentSome :: Maybe Pos -> ([b] -> m a) -> m b -> IndentOpt m a b
+ Text.Megaparsec.Char.Lexer: IndentSome :: Maybe Pos -> ([b] -> m a) -> m b -> IndentOpt (m :: Type -> Type) a b
- Text.Megaparsec.Char.Lexer: binary :: forall e s m a. (MonadParsec e s m, Token s ~ Char, Num a) => m a
+ Text.Megaparsec.Char.Lexer: binary :: (MonadParsec e s m, Token s ~ Char, Num a) => m a
- Text.Megaparsec.Char.Lexer: data IndentOpt m a b
+ Text.Megaparsec.Char.Lexer: data IndentOpt (m :: Type -> Type) a b
- Text.Megaparsec.Char.Lexer: hexadecimal :: forall e s m a. (MonadParsec e s m, Token s ~ Char, Num a) => m a
+ Text.Megaparsec.Char.Lexer: hexadecimal :: (MonadParsec e s m, Token s ~ Char, Num a) => m a
- Text.Megaparsec.Char.Lexer: octal :: forall e s m a. (MonadParsec e s m, Token s ~ Char, Num a) => m a
+ Text.Megaparsec.Char.Lexer: octal :: (MonadParsec e s m, Token s ~ Char, Num a) => m a
- Text.Megaparsec.Char.Lexer: scientific :: forall e s m. (MonadParsec e s m, Token s ~ Char) => m Scientific
+ Text.Megaparsec.Char.Lexer: scientific :: (MonadParsec e s m, Token s ~ Char) => m Scientific
- Text.Megaparsec.Debug: class (MonadParsec e s m) => MonadParsecDbg e s m
+ Text.Megaparsec.Debug: class MonadParsec e s m => MonadParsecDbg e s (m :: Type -> Type)
- Text.Megaparsec.Error: class (Ord a) => ShowErrorComponent a
+ Text.Megaparsec.Error: class Ord a => ShowErrorComponent a
- Text.Megaparsec.Error: errorBundlePretty :: forall s e. (VisualStream s, TraversableStream s, ShowErrorComponent e) => ParseErrorBundle s e -> String
+ Text.Megaparsec.Error: errorBundlePretty :: (VisualStream s, TraversableStream s, ShowErrorComponent e) => ParseErrorBundle s e -> String
- Text.Megaparsec.Error: errorBundlePrettyForGhcPreProcessors :: forall s e. (VisualStream s, TraversableStream s, ShowErrorComponent e) => ParseErrorBundle s e -> String
+ Text.Megaparsec.Error: errorBundlePrettyForGhcPreProcessors :: (VisualStream s, TraversableStream s, ShowErrorComponent e) => ParseErrorBundle s e -> String
- Text.Megaparsec.Error: errorBundlePrettyWith :: forall s e. (VisualStream s, TraversableStream s) => (Maybe String -> SourcePos -> ParseError s e -> String) -> ParseErrorBundle s e -> String
+ Text.Megaparsec.Error: errorBundlePrettyWith :: (VisualStream s, TraversableStream s) => (Maybe String -> SourcePos -> ParseError s e -> String) -> ParseErrorBundle s e -> String
- Text.Megaparsec.Error: parseErrorTextPretty :: forall s e. (VisualStream s, ShowErrorComponent e) => ParseError s e -> String
+ Text.Megaparsec.Error: parseErrorTextPretty :: (VisualStream s, ShowErrorComponent e) => ParseError s e -> String
- Text.Megaparsec.Error.Builder: etoks :: forall s. Stream s => Tokens s -> ET s
+ Text.Megaparsec.Error.Builder: etoks :: Stream s => Tokens s -> ET s
- Text.Megaparsec.Error.Builder: utoks :: forall s. Stream s => Tokens s -> ET s
+ Text.Megaparsec.Error.Builder: utoks :: Stream s => Tokens s -> ET s
- Text.Megaparsec.Internal: ParsecT :: (forall b. State s e -> (a -> State s e -> Hints (Token s) -> m b) -> (ParseError s e -> State s e -> m b) -> (a -> State s e -> Hints (Token s) -> m b) -> (ParseError s e -> State s e -> m b) -> m b) -> ParsecT e s m a
+ Text.Megaparsec.Internal: ParsecT :: (forall b. () => State s e -> (a -> State s e -> Hints (Token s) -> m b) -> (ParseError s e -> State s e -> m b) -> (a -> State s e -> Hints (Token s) -> m b) -> (ParseError s e -> State s e -> m b) -> m b) -> ParsecT e s (m :: Type -> Type) a
- Text.Megaparsec.Internal: [unParser] :: ParsecT e s m a -> forall b. State s e -> (a -> State s e -> Hints (Token s) -> m b) -> (ParseError s e -> State s e -> m b) -> (a -> State s e -> Hints (Token s) -> m b) -> (ParseError s e -> State s e -> m b) -> m b
+ Text.Megaparsec.Internal: [unParser] :: ParsecT e s (m :: Type -> Type) a -> forall b. () => State s e -> (a -> State s e -> Hints (Token s) -> m b) -> (ParseError s e -> State s e -> m b) -> (a -> State s e -> Hints (Token s) -> m b) -> (ParseError s e -> State s e -> m b) -> m b
- Text.Megaparsec.Internal: newtype ParsecT e s m a
+ Text.Megaparsec.Internal: newtype ParsecT e s (m :: Type -> Type) a
- Text.Megaparsec.Internal: withParsecT :: forall e e' s m a. Ord e' => (e -> e') -> ParsecT e s m a -> ParsecT e' s m a
+ Text.Megaparsec.Internal: withParsecT :: forall e e' s (m :: Type -> Type) a. Ord e' => (e -> e') -> ParsecT e s m a -> ParsecT e' s m a
- Text.Megaparsec.Stream: class (Ord (Token s), Ord (Tokens s)) => Stream s where {
+ Text.Megaparsec.Stream: class (Ord Token s, Ord Tokens s) => Stream s where {
- Text.Megaparsec.Stream: class (Stream s) => TraversableStream s
+ Text.Megaparsec.Stream: class Stream s => TraversableStream s
- Text.Megaparsec.Stream: class (Stream s) => VisualStream s
+ Text.Megaparsec.Stream: class Stream s => VisualStream s
- Text.Megaparsec.Stream: type Token s :: Type;
+ Text.Megaparsec.Stream: type Token s;
- Text.Megaparsec.Stream: type Tokens s :: Type;
+ Text.Megaparsec.Stream: type Tokens s;
Files
- CHANGELOG.md +5/−0
- README.md +1/−1
- Text/Megaparsec.hs +4/−4
- Text/Megaparsec/Class.hs +2/−2
- Text/Megaparsec/Error.hs +4/−12
- Text/Megaparsec/Error/Builder.hs +2/−3
- Text/Megaparsec/Internal.hs +6/−6
- Text/Megaparsec/Pos.hs +3/−4
- Text/Megaparsec/State.hs +2/−3
- megaparsec.cabal +5/−5
CHANGELOG.md view
@@ -1,5 +1,10 @@ *Megaparsec follows [SemVer](https://semver.org/).* +## Megaparsec 9.7.1++* Typo fixes and compatibility with `QuickCheck >= 2.17` for+ `megaparsec-tests`.+ ## Megaparsec 9.7.0 * Implemented correct handling of wide Unicode characters in error messages.
README.md view
@@ -4,7 +4,7 @@ [](https://hackage.haskell.org/package/megaparsec) [](http://stackage.org/nightly/package/megaparsec) [](http://stackage.org/lts/package/megaparsec)-+[](https://github.com/mrkkrp/megaparsec/actions/workflows/ci.yaml) * [Features](#features) * [Core features](#core-features)
Text/Megaparsec.hs view
@@ -386,8 +386,8 @@ -- | Register a 'ParseError' for later reporting. This action does not end -- parsing and has no effect except for adding the given 'ParseError' to the -- collection of “delayed” 'ParseError's which will be taken into--- consideration at the end of parsing. Only if this collection is empty the--- parser will succeed. This is the main way to report several parse errors+-- consideration at the end of parsing. Only if this collection is empty will+-- the parser succeed. This is the main way to report several parse errors -- at once. -- -- @since 8.0.0@@ -523,7 +523,7 @@ oneOf cs = satisfy (\x -> elem x cs) {-# INLINE oneOf #-} --- | As the dual of 'oneOf', @'noneOf' ts@ succeeds if the current token+-- | As the dual of 'oneOf', @'noneOf' ts@ succeeds if the current token is -- /not/ in the supplied list of tokens @ts@. Returns the parsed character. -- Note that this parser cannot automatically generate the “expected” -- component of error message, so usually you should label it manually with@@ -539,7 +539,7 @@ -- @since 7.0.0 noneOf :: (Foldable f, MonadParsec e s m) =>- -- | Collection of taken we should not match+ -- | Collection of tokens we should not match f (Token s) -> m (Token s) noneOf cs = satisfy (\x -> notElem x cs)
Text/Megaparsec/Class.hs view
@@ -126,7 +126,7 @@ -- to the point where the next object starts. -- -- Note that if @r@ fails, the original error message is reported as if- -- without 'withRecovery'. In no way recovering parser @r@ can influence+ -- without 'withRecovery'. In no way can the recovering parser @r@ influence -- error messages. -- -- @since 4.4.0@@ -245,7 +245,7 @@ m (Tokens s) -- | Extract the specified number of tokens from the input stream and- -- return them packed as a chunk of stream. If there is not enough tokens+ -- return them packed as a chunk of stream. If there are not enough tokens -- in the stream, a parse error will be signaled. It's guaranteed that if -- the parser succeeds, the requested number of tokens will be returned. --
Text/Megaparsec/Error.hs view
@@ -83,7 +83,7 @@ Label (NonEmpty Char) | -- | End of input EndOfInput- deriving (Show, Read, Eq, Ord, Data, Typeable, Generic, Functor)+ deriving (Show, Read, Eq, Ord, Data, Generic, Functor) instance (NFData t) => NFData (ErrorItem t) @@ -101,7 +101,7 @@ ErrorIndentation Ordering Pos Pos | -- | Custom error data ErrorCustom e- deriving (Show, Read, Eq, Ord, Data, Typeable, Generic, Functor)+ deriving (Show, Read, Eq, Ord, Data, Generic, Functor) instance (NFData a) => NFData (ErrorFancy a) where rnf (ErrorFail str) = rnf str@@ -129,7 +129,7 @@ -- -- Type of the first argument was changed in the version /7.0.0/. FancyError Int (Set (ErrorFancy e))- deriving (Typeable, Generic)+ deriving (Generic) deriving instance ( Show (Token s),@@ -168,8 +168,7 @@ {-# INLINE mappend #-} instance- ( Show s,- Show (Token s),+ ( Show (Token s), Show e, ShowErrorComponent e, VisualStream s,@@ -268,13 +267,6 @@ Eq e ) => Eq (ParseErrorBundle s e)--deriving instance- ( Typeable s,- Typeable (Token s),- Typeable e- ) =>- Typeable (ParseErrorBundle s e) deriving instance ( Data s,
Text/Megaparsec/Error/Builder.hs view
@@ -47,7 +47,6 @@ import Data.Proxy import Data.Set (Set) import qualified Data.Set as E-import Data.Typeable (Typeable) import GHC.Generics import Text.Megaparsec.Error import Text.Megaparsec.Stream@@ -57,7 +56,7 @@ -- | Auxiliary type for construction of trivial parse errors. data ET s = ET (Maybe (ErrorItem (Token s))) (Set (ErrorItem (Token s)))- deriving (Typeable, Generic)+ deriving (Generic) deriving instance (Eq (Token s)) => Eq (ET s) @@ -84,7 +83,7 @@ -- | Auxiliary type for construction of fancy parse errors. newtype EF e = EF (Set (ErrorFancy e))- deriving (Eq, Ord, Data, Typeable, Generic)+ deriving (Eq, Ord, Data, Generic) instance (Ord e) => Semigroup (EF e) where EF xs0 <> EF xs1 = EF (E.union xs0 xs1)
Text/Megaparsec/Internal.hs view
@@ -440,10 +440,10 @@ pNotFollowedBy :: (Stream s) => ParsecT e s m a -> ParsecT e s m () pNotFollowedBy p = ParsecT $ \s@(State input o _ _) _ _ eok eerr -> let what = maybe EndOfInput (Tokens . nes . fst) (take1_ input)- unexpect u = TrivialError o (pure u) E.empty- cok' _ _ _ = eerr (unexpect what) s+ unexpected u = TrivialError o (pure u) E.empty+ cok' _ _ _ = eerr (unexpected what) s cerr' _ _ = eok () s mempty- eok' _ _ _ = eerr (unexpect what) s+ eok' _ _ _ = eerr (unexpected what) s eerr' _ _ = eok () s mempty in unParser p s cok' cerr' eok' eerr' {-# INLINE pNotFollowedBy #-}@@ -521,14 +521,14 @@ ParsecT e s m (Tokens s) pTokens f tts = ParsecT $ \s@(State input o pst de) cok _ eok eerr -> let pxy = Proxy :: Proxy s- unexpect pos' u =+ unexpected pos' u = let us = pure u ps = (E.singleton . Tokens . NE.fromList . chunkToTokens pxy) tts in TrivialError pos' us ps len = chunkLength pxy tts in case takeN_ len input of Nothing ->- eerr (unexpect o EndOfInput) s+ eerr (unexpected o EndOfInput) s Just (tts', input') -> if f tts tts' then@@ -538,7 +538,7 @@ else cok tts' st mempty else let ps = (Tokens . NE.fromList . chunkToTokens pxy) tts'- in eerr (unexpect o ps) (State input o pst de)+ in eerr (unexpected o ps) (State input o pst de) {-# INLINE pTokens #-} pTakeWhileP ::
Text/Megaparsec/Pos.hs view
@@ -36,7 +36,6 @@ import Control.DeepSeq import Control.Exception import Data.Data (Data)-import Data.Typeable (Typeable) import GHC.Generics ----------------------------------------------------------------------------@@ -49,7 +48,7 @@ -- -- @since 5.0.0 newtype Pos = Pos Int- deriving (Show, Eq, Ord, Data, Generic, Typeable, NFData)+ deriving (Show, Eq, Ord, Data, Generic, NFData) -- | Construction of 'Pos' from 'Int'. The function throws -- 'InvalidPosException' when given a non-positive argument.@@ -105,7 +104,7 @@ newtype InvalidPosException = -- | Contains the actual value that was passed to 'mkPos' InvalidPosException Int- deriving (Eq, Show, Data, Typeable, Generic)+ deriving (Eq, Show, Data, Generic) instance Exception InvalidPosException @@ -126,7 +125,7 @@ -- | Column number sourceColumn :: !Pos }- deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)+ deriving (Show, Read, Eq, Ord, Data, Generic) instance NFData SourcePos
Text/Megaparsec/State.hs view
@@ -29,7 +29,6 @@ import Control.DeepSeq (NFData) import Data.Data (Data)-import Data.Typeable (Typeable) import GHC.Generics import {-# SOURCE #-} Text.Megaparsec.Error (ParseError) import Text.Megaparsec.Pos@@ -53,7 +52,7 @@ -- @since 8.0.0 stateParseErrors :: [ParseError s e] }- deriving (Typeable, Generic)+ deriving (Generic) deriving instance ( Show (ParseError s e),@@ -110,7 +109,7 @@ -- | Prefix to prepend to offending line pstateLinePrefix :: String }- deriving (Show, Eq, Data, Typeable, Generic)+ deriving (Show, Eq, Data, Generic) instance (NFData s) => NFData (PosState s)
megaparsec.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: megaparsec-version: 9.7.0+version: 9.7.1 license: BSD-2-Clause license-file: LICENSE.md maintainer: Mark Karpov <markkarpov92@gmail.com>@@ -9,7 +9,7 @@ Paolo Martini <paolo@nemail.it>, Daan Leijen <daan@microsoft.com> -tested-with: ghc ==9.6.3 ghc ==9.8.2 ghc ==9.10.1+tested-with: ghc ==9.10.3 ghc ==9.12.4 ghc ==9.14.1 homepage: https://github.com/mrkkrp/megaparsec bug-reports: https://github.com/mrkkrp/megaparsec/issues synopsis: Monadic parser combinators@@ -61,7 +61,7 @@ base >=4.15 && <5, bytestring >=0.2 && <0.13, case-insensitive >=1.2 && <1.3,- containers >=0.5 && <0.8,+ containers >=0.5 && <0.9, deepseq >=1.3 && <1.6, mtl >=2.2.2 && <3, parser-combinators >=1.0 && <2,@@ -88,7 +88,7 @@ build-depends: base >=4.15 && <5, bytestring >=0.2 && <0.13,- containers >=0.5 && <0.8,+ containers >=0.5 && <0.9, criterion >=0.6.2.1 && <1.7, deepseq >=1.3 && <1.6, megaparsec,@@ -110,7 +110,7 @@ build-depends: base >=4.15 && <5, bytestring >=0.2 && <0.13,- containers >=0.5 && <0.8,+ containers >=0.5 && <0.9, deepseq >=1.3 && <1.6, megaparsec, text >=0.2 && <2.2,