diff --git a/cabal.project b/cabal.project new file mode 100644 index 0000000000000000000000000000000000000000..87216b5338fc451189cd7de01f43c15f37efcad8 --- /dev/null +++ b/cabal.project @@ -0,0 +1,4 @@ +packages: *.cabal + +constraints: + json -pretty -parsec -generic diff --git a/ma.cabal b/ma.cabal index e2eba8a322d6e5fa1890de250452d1f80b736072..9c45d96e6694fd438b7c1d02be878193f88b520e 100644 --- a/ma.cabal +++ b/ma.cabal @@ -91,7 +91,7 @@ library , mtl , extra , containers - , megaparsec >= 6.5 && < 7.0 + , megaparsec >= 7 && <8 , deriving-compat , ieee754 ghc-options: -Wall -Wno-name-shadowing @@ -159,13 +159,14 @@ test-suite spec , vector-algorithms , bytestring , text - , megaparsec >= 6.5 && < 7.0 - , hspec-megaparsec + , megaparsec >= 7 && <8 + , hspec-megaparsec >= 2.0 && <2.1 , microlens-platform , unordered-containers , containers , mtl , ma + build-tool-depends: hspec-discover:hspec-discover ==2.* test-suite doctests type: exitcode-stdio-1.0 @@ -213,7 +214,7 @@ benchmark bench , ma , criterion , text - , megaparsec >= 6.5 && < 7.0 + , megaparsec >= 7 && <8 , deepseq , vector , mtl @@ -231,7 +232,7 @@ executable prism-converter build-depends: base >= 4.11 , text , vector - , megaparsec >= 6.5 && < 7.0 + , megaparsec >= 7 , containers , optparse-applicative , prettyprinter diff --git a/src/MA/Coalgebra/Parser.hs b/src/MA/Coalgebra/Parser.hs index b4b7df14bbcc94a2cee491cc38285362ff30fc3f..b190bbc93bb4331d7c12bd2654e8962cab1f607e 100644 --- a/src/MA/Coalgebra/Parser.hs +++ b/src/MA/Coalgebra/Parser.hs @@ -120,7 +120,7 @@ parseMorphisms :: => FunctorExpression f Sort -> String -> Text - -> Either (ParseError Char Void) ( SymbolTable + -> Either (ParseErrorBundle Text Void) ( SymbolTable , Encoding (Label (Desorted f)) (H1 (Desorted f))) parseMorphisms = parse . morphismsParser diff --git a/src/MA/Dot.hs b/src/MA/Dot.hs index cb827231f21bd4a51b6cf32d9f959a5d100a442f..0f20d4f2b66c821bc631f4a402d69bdd66b56f0c 100644 --- a/src/MA/Dot.hs +++ b/src/MA/Dot.hs @@ -5,8 +5,6 @@ module MA.Dot , defaultDotConfig ) where -import Data.Semigroup - import Data.Text.Lazy.Builder (Builder) import qualified Data.Text.Lazy.Builder as Build import qualified Data.Text.Lazy.Builder.Int as Build diff --git a/src/MA/FunctorExpression/Pretty.hs b/src/MA/FunctorExpression/Pretty.hs index 8506f2c42dc078e6f429820d8e3be3bb7550bb89..8c6b950c84a3bcb4c36dc5ceb8a342d8d545aa63 100644 --- a/src/MA/FunctorExpression/Pretty.hs +++ b/src/MA/FunctorExpression/Pretty.hs @@ -3,7 +3,6 @@ module MA.FunctorExpression.Pretty , pretty ) where -import Data.Semigroup import Data.Text.Lazy (Text) import qualified Data.Text.Lazy.Builder as Build import Data.Text.Lazy.Builder (Builder) diff --git a/src/MA/FunctorExpression/Sorts.hs b/src/MA/FunctorExpression/Sorts.hs index 0abc7b990715b5636aeed48f6a5b4c3f76c48ca1..77ac7602b055e28d6f76be5703f073879624d278 100644 --- a/src/MA/FunctorExpression/Sorts.hs +++ b/src/MA/FunctorExpression/Sorts.hs @@ -19,7 +19,6 @@ module MA.FunctorExpression.Sorts import Data.Foldable import Data.List (intersperse) -import Data.Semigroup import GHC.Generics import Control.Monad.State diff --git a/src/MA/Parser.hs b/src/MA/Parser.hs index cbff23e6698d719522044a6680c233ba60013480..ce3e1db26812c225d87424869181706bbd4ce9a0 100644 --- a/src/MA/Parser.hs +++ b/src/MA/Parser.hs @@ -68,7 +68,7 @@ parseFunctor name input = (Polynomial (Sum (E.fromList [Product (E.fromList [Identity Variable])])))) in bimap - parseErrorPretty + errorBundlePretty id (parse (functorExpressionParser identity functorParsers) name input) where @@ -89,7 +89,7 @@ parseCoalgebra functor name input = (Sum (E.fromList [Product (E.fromList [Identity Variable])])))) eitherFunctor = maybe (Left (identity, functorParsers)) Right functor in bimap - parseErrorPretty + errorBundlePretty (Proxy, ) (parse (coalgebraParser eitherFunctor) name input) where diff --git a/src/MA/Parser/Types.hs b/src/MA/Parser/Types.hs index cc117e77843a47cf0b99d8805bb3d6bfbf89c931..3356cc334d04fc62c4a945b712c50d6306e3e835 100644 --- a/src/MA/Parser/Types.hs +++ b/src/MA/Parser/Types.hs @@ -15,6 +15,6 @@ type ParserT = ParsecT Void Text type Parser = Parsec Void Text -type ParseErr = ParseError Char Void +type ParseErr = ParseErrorBundle Text Void type MonadParser = MonadParsec Void Text diff --git a/src/MA/PartitionPrinter.hs b/src/MA/PartitionPrinter.hs index 31c901f8caff611f124cececcd55a5861c8ddb65..0278d6c54d4f83808660aea6067b03ae9395f8da 100644 --- a/src/MA/PartitionPrinter.hs +++ b/src/MA/PartitionPrinter.hs @@ -6,7 +6,6 @@ module MA.PartitionPrinter import Data.Foldable import Data.List (intersperse) -import Data.Semigroup import qualified Data.HashMap.Strict as M import Data.IntSet (IntSet) diff --git a/src/prism-converter/Main.hs b/src/prism-converter/Main.hs index c6c6e628ca55b00c3a6cc6c7a4cf7874902d4578..08308d1e3c9711d5432a90532ea4b268c4e4f477 100644 --- a/src/prism-converter/Main.hs +++ b/src/prism-converter/Main.hs @@ -118,7 +118,7 @@ parseInput file parser = do case parse (parser <* eof) name input of Left err -> do - hPutStr stderr (parseErrorPretty err) + hPutStr stderr (errorBundlePretty err) exitFailure Right res -> return res diff --git a/src/prism-converter/StatesFile.hs b/src/prism-converter/StatesFile.hs index 975711d05ace71b8bf43f6b23d404602186603ea..71659fd75441df51bfd2ce68065963ca9ec73023 100644 --- a/src/prism-converter/StatesFile.hs +++ b/src/prism-converter/StatesFile.hs @@ -69,7 +69,7 @@ varIndicesP = S.fromList <$> nameP `sepBy` symbolP "," parseVarIndices :: String -> Either String (Set Text) parseVarIndices input = - first (parseErrorPretty) (parse (varIndicesP <* eof) input (T.pack input)) + first errorBundlePretty (parse (varIndicesP <* eof) input (T.pack input)) ---------------------------------------------------------------------- -- Partitioning diff --git a/stack.yaml b/stack.yaml index a9823d47f870f3ea984a2fbda0e9c504d2ab31a3..a214ca564537ad066f590c28187930a8a8a46961 100644 --- a/stack.yaml +++ b/stack.yaml @@ -40,7 +40,8 @@ packages: # Dependency packages to be pulled from upstream that are not in the resolver # (e.g., acme-missiles-0.3) extra-deps: - - hspec-megaparsec-1.1.0 + - hspec-megaparsec-2.0.0 + - megaparsec-7.0.1 - prettyprinter-convert-ansi-wl-pprint-1.1 # Override default flag values for local packages and extra-deps diff --git a/tests/MA/Coalgebra/ParserSpec.hs b/tests/MA/Coalgebra/ParserSpec.hs index 34a7533fdec2ca9ee3945643953de2d81b4f46c9..3aa28d16e53a2a16605833c70c51a98c6f501078 100644 --- a/tests/MA/Coalgebra/ParserSpec.hs +++ b/tests/MA/Coalgebra/ParserSpec.hs @@ -190,7 +190,7 @@ instance ParseMorphism SomeFunctor where parsing :: (Functor f, ParseMorphism f) => FunctorExpression f Sort -> Text - -> Either (ParseError Char Void) (Encoding (Sorted (Label f)) (Sorted (H1 f))) + -> Either (ParseErrorBundle Text Void) (Encoding (Sorted (Label f)) (Sorted (H1 f))) parsing expr = fmap snd . parseMorphisms expr "" diff --git a/tests/MA/Functors/PolynomialSpec.hs b/tests/MA/Functors/PolynomialSpec.hs index 41e04d03ad4163807cbcba2960219abc7c464415..858b1d8c1d6a5fa3dfcc89bb5f5f8acea4c8cd9f 100644 --- a/tests/MA/Functors/PolynomialSpec.hs +++ b/tests/MA/Functors/PolynomialSpec.hs @@ -11,7 +11,7 @@ import qualified Data.List.NonEmpty as NonEmpty import Data.Proxy import Type.Reflection -import Text.Megaparsec (parseErrorPretty) +import Text.Megaparsec (errorBundlePretty) import Data.Vector (Vector) import qualified Data.Vector as V import Data.Text (Text) @@ -133,7 +133,7 @@ functorExpressionSpec = describe "functorExpression" $ do -- "X" as functor. it "gives a useful error message for non-unique keys" $ do let Left err = p "X^{a, a}" - parseErrorPretty err `shouldSatisfy` ("unique" `isInfixOf`) + errorBundlePretty err `shouldSatisfy` ("unique" `isInfixOf`) it "allows to use intergers as set for constants" $ do p "Z" `shouldParse` (Functor 1 (mkPoly [[Const IntSet]]))