Move to megaparsec version 7.0.0. (#565)
* Move to megaparsec version 7.0.0. * Add megaparsec.nix
This commit is contained in:
parent
410ea8adc6
commit
469f6ddf44
|
@ -185,7 +185,7 @@ Library
|
|||
haskeline >= 0.7.3.0 && < 0.8 ,
|
||||
insert-ordered-containers >= 0.2.1.0 && < 0.3 ,
|
||||
lens-family-core >= 1.0.0 && < 1.3 ,
|
||||
megaparsec >= 6.1.1 && < 6.6 ,
|
||||
megaparsec >= 7.0.0 && < 7.1 ,
|
||||
memory >= 0.14 && < 0.15,
|
||||
mtl >= 2.2.1 && < 2.3 ,
|
||||
optparse-applicative < 0.15,
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
{ mkDerivation, base, bytestring, case-insensitive, containers
|
||||
, criterion, deepseq, hspec, hspec-expectations, mtl
|
||||
, parser-combinators, QuickCheck, scientific, stdenv, text
|
||||
, transformers, weigh
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "megaparsec";
|
||||
version = "7.0.0";
|
||||
sha256 = "bfd6870d468d680e5ca8845afb8c871d8e40231ae95a977407c371c251cc3380";
|
||||
libraryHaskellDepends = [
|
||||
base bytestring case-insensitive containers deepseq mtl
|
||||
parser-combinators scientific text transformers
|
||||
];
|
||||
testHaskellDepends = [
|
||||
base bytestring case-insensitive containers hspec
|
||||
hspec-expectations mtl parser-combinators QuickCheck scientific
|
||||
text transformers
|
||||
];
|
||||
benchmarkHaskellDepends = [
|
||||
base containers criterion deepseq text weigh
|
||||
];
|
||||
homepage = "https://github.com/mrkkrp/megaparsec";
|
||||
description = "Monadic parser combinators";
|
||||
license = stdenv.lib.licenses.bsd2;
|
||||
}
|
|
@ -41,13 +41,13 @@ exprA = completeExpression
|
|||
|
||||
-- | A parsing error
|
||||
data ParseError = ParseError
|
||||
{ unwrap :: Text.Megaparsec.ParseError Char Void
|
||||
{ unwrap :: Text.Megaparsec.ParseErrorBundle Text Void
|
||||
, input :: Text
|
||||
}
|
||||
|
||||
instance Show ParseError where
|
||||
show (ParseError {..}) =
|
||||
"\n\ESC[1;31mError\ESC[0m: Invalid input\n\n" <> Text.Megaparsec.parseErrorPretty' input unwrap
|
||||
"\n\ESC[1;31mError\ESC[0m: Invalid input\n\n" <> Text.Megaparsec.errorBundlePretty unwrap
|
||||
|
||||
instance Exception ParseError
|
||||
|
||||
|
|
|
@ -87,13 +87,13 @@ instance Text.Parser.Combinators.Parsing Parser where
|
|||
notFollowedBy = Text.Megaparsec.notFollowedBy
|
||||
|
||||
instance Text.Parser.Char.CharParsing Parser where
|
||||
satisfy = Parser . Text.Megaparsec.Char.satisfy
|
||||
satisfy = Parser . Text.Megaparsec.satisfy
|
||||
|
||||
char = Text.Megaparsec.Char.char
|
||||
|
||||
notChar = Text.Megaparsec.Char.char
|
||||
|
||||
anyChar = Text.Megaparsec.Char.anyChar
|
||||
anyChar = Text.Megaparsec.anySingle
|
||||
|
||||
string = fmap Data.Text.unpack . Text.Megaparsec.Char.string . fromString
|
||||
|
||||
|
@ -102,7 +102,7 @@ instance Text.Parser.Char.CharParsing Parser where
|
|||
instance TokenParsing Parser where
|
||||
someSpace =
|
||||
Text.Parser.Token.Style.buildSomeSpaceParser
|
||||
(Parser (Text.Megaparsec.skipSome (Text.Megaparsec.Char.satisfy Data.Char.isSpace)))
|
||||
(Parser (Text.Megaparsec.skipSome (Text.Megaparsec.satisfy Data.Char.isSpace)))
|
||||
Text.Parser.Token.Style.haskellCommentStyle
|
||||
|
||||
highlight _ = id
|
||||
|
|
|
@ -29,9 +29,9 @@ import Dhall.Parser.Token
|
|||
|
||||
noted :: Parser (Expr Src a) -> Parser (Expr Src a)
|
||||
noted parser = do
|
||||
before <- Text.Megaparsec.getPosition
|
||||
before <- Text.Megaparsec.getSourcePos
|
||||
(tokens, e) <- Text.Megaparsec.match parser
|
||||
after <- Text.Megaparsec.getPosition
|
||||
after <- Text.Megaparsec.getSourcePos
|
||||
let src₀ = Src before after tokens
|
||||
case e of
|
||||
Note src₁ _ | src₀ == src₁ -> return e
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
resolver: lts-12.4
|
||||
extra-deps:
|
||||
- serialise-0.2.0.0
|
||||
- megaparsec-7.0.0@rev:0
|
||||
# Version 0.2.0.0 of cborg, the latest on Hackage, is broken on i386.
|
||||
- github: well-typed/cborg
|
||||
commit: master
|
||||
subdirs:
|
||||
- cborg
|
||||
- serialise
|
||||
nix:
|
||||
packages:
|
||||
- ncurses
|
||||
|
|
Loading…
Reference in New Issue