Fix nix definitions for Megaparsec 9

This commit is contained in:
Mark Karpov 2020-09-21 20:14:49 +02:00
parent 1f574c42ea
commit 2fd1884794
4 changed files with 8 additions and 118 deletions

View File

@ -66,14 +66,12 @@ let
"modern-uri" = doBenchmark super.modern-uri; "modern-uri" = doBenchmark super.modern-uri;
"parsers-bench" = doBenchmark "parsers-bench" = doBenchmark
(super.callCabal2nix "parsers-bench" parsersBenchSource { }); (super.callCabal2nix "parsers-bench" parsersBenchSource { });
"hspec-megaparsec" = "hspec-megaparsec" = super.hspec-megaparsec_2_2_0;
patch super.hspec-megaparsec ./nix/patches/hspec-megaparsec.patch; "dhall" = doJailbreak (patch super.dhall ./nix/patches/dhall.patch);
"dhall" = "idris" = doJailbreak (patch super.idris ./nix/patches/idris.patch);
patch super.dhall ./nix/patches/dhall.patch; "tomland" = super.tomland_1_3_1_0;
"idris" = "stache" = super.stache_2_2_0;
patch super.idris ./nix/patches/idris.patch; "language-puppet" = doJailbreak super.language-puppet;
"tomland" =
patch super.tomland ./nix/patches/tomland.patch;
}; };
updatedPkgs = pkgs // { updatedPkgs = pkgs // {

View File

@ -1,6 +1,6 @@
let let
rev = "32b46dd897ab2143a609988a04d87452f0bbef59"; rev = "84d74ae9c9cbed73274b8e4e00be14688ffc93fe";
sha256 = "1gzfrpjnr1bz9zljsyg3a4zrhk8r927sz761mrgcg56dwinkhpjk"; sha256 = "0ww70kl08rpcsxb9xdx8m48vz41dpss4hh3vvsmswll35l158x0v";
nixpkgs = builtins.fetchTarball { nixpkgs = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
inherit sha256; inherit sha256;

View File

@ -1,84 +0,0 @@
diff --git a/Test/Hspec/Megaparsec.hs b/Test/Hspec/Megaparsec.hs
index e639426..c0ef679 100644
--- a/Test/Hspec/Megaparsec.hs
+++ b/Test/Hspec/Megaparsec.hs
@@ -51,7 +51,8 @@ import qualified Data.List.NonEmpty as NE
shouldParse
:: ( HasCallStack
, ShowErrorComponent e
- , Stream s
+ , VisualStream s
+ , TraversableStream s
, Show a
, Eq a
)
@@ -72,7 +73,8 @@ r `shouldParse` v = case r of
parseSatisfies
:: ( HasCallStack
, ShowErrorComponent e
- , Stream s
+ , VisualStream s
+ , TraversableStream s
, Show a
, Eq a
)
@@ -106,7 +108,8 @@ p `shouldFailOn` s = shouldFail (p s)
shouldSucceedOn
:: ( HasCallStack
, ShowErrorComponent e
- , Stream s
+ , VisualStream s
+ , TraversableStream s
, Show a
)
=> (s -> Either (ParseErrorBundle s e) a)
@@ -127,7 +130,8 @@ p `shouldSucceedOn` s = shouldSucceed (p s)
shouldFailWith
:: ( HasCallStack
, ShowErrorComponent e
- , Stream s
+ , VisualStream s
+ , TraversableStream s
, Show a
, Eq e
)
@@ -144,7 +148,8 @@ r `shouldFailWith` perr1 = r `shouldFailWithM` [perr1]
shouldFailWithM
:: ( HasCallStack
, ShowErrorComponent e
- , Stream s
+ , VisualStream s
+ , TraversableStream s
, Show a
, Eq e
)
@@ -208,7 +213,8 @@ succeedsLeaving
, Eq s
, Show s
, ShowErrorComponent e
- , Stream s
+ , VisualStream s
+ , TraversableStream s
)
=> (State s e, Either (ParseErrorBundle s e) a)
-- ^ Parser that takes stream and produces result along with actual
@@ -261,7 +267,8 @@ shouldFail r = case r of
shouldSucceed
:: ( HasCallStack
, ShowErrorComponent e
- , Stream s
+ , VisualStream s
+ , TraversableStream s
, Show a
)
=> Either (ParseErrorBundle s e) a
@@ -291,7 +298,8 @@ checkUnconsumed e a = unless (e == a) . expectationFailure $
showBundle
:: ( ShowErrorComponent e
- , Stream s
+ , VisualStream s
+ , TraversableStream s
)
=> ParseErrorBundle s e
-> String

View File

@ -1,24 +0,0 @@
diff --git a/test/Test/Toml/Parser/Common.hs b/test/Test/Toml/Parser/Common.hs
index 43d9069..cc5d9e3 100644
--- a/test/Test/Toml/Parser/Common.hs
+++ b/test/Test/Toml/Parser/Common.hs
@@ -39,7 +39,7 @@ import Data.Time (Day, LocalTime (..), TimeOfDay (..), TimeZone, ZonedTime (..),
minutesToTimeZone)
import Test.Hspec (Expectation)
import Test.Hspec.Megaparsec (shouldFailOn, shouldParse)
-import Text.Megaparsec (Parsec, ShowErrorComponent, Stream, parse)
+import Text.Megaparsec (Parsec, ShowErrorComponent, Stream, VisualStream, TraversableStream, parse)
import Toml.Parser.Item (tomlP)
import Toml.Parser.Key (keyP)
@@ -50,9 +50,8 @@ import Toml.Type.Key (Key (..))
import Toml.Type.TOML (TOML (..))
import Toml.Type.UValue (UValue (..))
-
parseX
- :: (ShowErrorComponent e, Stream s, Show a, Eq a)
+ :: (ShowErrorComponent e, Stream s, Show a, Eq a, VisualStream s, TraversableStream s)
=> Parsec e s a -> s -> a -> Expectation
parseX p given expected = parse p "" given `shouldParse` expected