grammatical-parsers 0.2.1 → 0.2.2
raw patch · 6 files changed
+22/−22 lines, 6 filesdep ~basedep ~rank2classesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, rank2classes
API changes (from Hackage documentation)
- Text.Grampa: class MultiParsing m => GrammarParsing m where type GrammarFunctor m :: ((* -> *) -> *) -> * -> * -> * selfReferring = distributeWith nonTerminal id fixGrammar = ($ selfReferring) recursive = id where {
+ Text.Grampa: class MultiParsing m => GrammarParsing m where type GrammarFunctor m :: ((* -> *) -> *) -> * -> * -> * selfReferring = cotraverse nonTerminal id fixGrammar = ($ selfReferring) recursive = id where {
Files
- examples/Arithmetic.hs +5/−5
- examples/Combined.hs +8/−8
- examples/Comparisons.hs +2/−2
- grammatical-parsers.cabal +5/−5
- src/Text/Grampa/Class.hs +1/−1
- src/Text/Grampa/ContextFree/LeftRecursive.hs +1/−1
examples/Arithmetic.hs view
@@ -70,11 +70,11 @@ instance Rank2.DistributiveTraversable (Arithmetic e) instance Rank2.Distributive (Arithmetic e) where- distributeWith w f = Arithmetic{expr= w (expr <$> f),- sum= w (sum <$> f),- product= w (product <$> f),- factor= w (factor <$> f),- primary= w (primary <$> f)}+ cotraverse w f = Arithmetic{expr= w (expr <$> f),+ sum= w (sum <$> f),+ product= w (product <$> f),+ factor= w (factor <$> f),+ primary= w (primary <$> f)} instance Rank2.Foldable (Arithmetic e) where foldMap f a = f (expr a) <> f (sum a) <> f (product a) <> f (factor a) <> f (primary a)
examples/Combined.hs view
@@ -159,14 +159,14 @@ comparisonGrammar= Rank2.distributeM (comparisonGrammar <$> f), conditionalGrammar= Rank2.distributeM (conditionalGrammar <$> f), lambdaGrammar= Rank2.distributeM (lambdaGrammar <$> f)}- distributeWith w f = Expression{expr= w (expr <$> f),- term= w (term <$> f),- primary= w (primary <$> f),- arithmeticGrammar= Rank2.distributeWith w (arithmeticGrammar <$> f),- booleanGrammar= Rank2.distributeWith w (booleanGrammar <$> f),- comparisonGrammar= Rank2.distributeWith w (comparisonGrammar <$> f),- conditionalGrammar= Rank2.distributeWith w (conditionalGrammar <$> f),- lambdaGrammar= Rank2.distributeWith w (lambdaGrammar <$> f)}+ cotraverse w f = Expression{expr= w (expr <$> f),+ term= w (term <$> f),+ primary= w (primary <$> f),+ arithmeticGrammar= Rank2.cotraverse w (arithmeticGrammar <$> f),+ booleanGrammar= Rank2.cotraverse w (booleanGrammar <$> f),+ comparisonGrammar= Rank2.cotraverse w (comparisonGrammar <$> f),+ conditionalGrammar= Rank2.cotraverse w (conditionalGrammar <$> f),+ lambdaGrammar= Rank2.cotraverse w (lambdaGrammar <$> f)} instance Rank2.Foldable Expression where foldMap f g = f (expr g) <> f (term g) <> f (primary g)
examples/Comparisons.hs view
@@ -51,8 +51,8 @@ instance Rank2.DistributiveTraversable (Comparisons c e) instance Rank2.Distributive (Comparisons c e) where- distributeWith w f = Comparisons{test= w (test <$> f),- term= w (term <$> f)}+ cotraverse w f = Comparisons{test= w (test <$> f),+ term= w (term <$> f)} instance Rank2.Foldable (Comparisons c e) where foldMap f g = f (test g) <> f (term g)
grammatical-parsers.cabal view
@@ -1,5 +1,5 @@ name: grammatical-parsers-version: 0.2.1+version: 0.2.2 synopsis: parsers that can combine into grammars description: /Gram/matical-/pa/rsers, or Grampa for short, is a library of parser types whose values are meant to be assigned@@ -39,7 +39,7 @@ transformers >= 0.5 && < 0.6, monoid-subclasses >=0.4 && <0.5, parsers < 0.13,- rank2classes < 1.0+ rank2classes == 1.0.* -- hs-source-dirs: default-language: Haskell2010 @@ -50,7 +50,7 @@ default-language: Haskell2010 build-depends: base >=4.7 && <5, containers >= 0.5.7.0 && < 0.6, parsers < 0.13,- rank2classes < 1.0, grammatical-parsers,+ rank2classes == 1.0.*, grammatical-parsers, monoid-subclasses >=0.4 && <0.5 test-suite quicktests@@ -58,7 +58,7 @@ hs-source-dirs: test, examples x-uses-tf: true build-depends: base >=4.7 && < 5, monoid-subclasses < 0.5, parsers < 0.13,- rank2classes < 1.0, grammatical-parsers,+ rank2classes == 1.0.*, grammatical-parsers, QuickCheck >= 2 && < 3, checkers >= 0.4.6 && < 0.5, testing-feat < 0.5, tasty >= 0.7, tasty-quickcheck >= 0.7 main-is: Test.hs@@ -77,7 +77,7 @@ type: exitcode-stdio-1.0 hs-source-dirs: test, examples ghc-options: -O2 -Wall -rtsopts -main-is Benchmark.main- Build-Depends: base >=4.7 && < 5, rank2classes < 1.0, grammatical-parsers, monoid-subclasses >=0.4 && <0.5,+ Build-Depends: base >=4.7 && < 5, rank2classes == 1.0.*, grammatical-parsers, monoid-subclasses >=0.4 && <0.5, criterion >= 1.0, deepseq >= 1.1, containers >= 0.5.7.0 && < 0.6, text >= 1.1 main-is: Benchmark.hs other-modules: Arithmetic
src/Text/Grampa/Class.hs view
@@ -50,7 +50,7 @@ -- | Mark a parser that relies on primitive recursion to prevent an infinite loop in 'fixGrammar'. recursive :: m g s a -> m g s a - selfReferring = Rank2.distributeWith nonTerminal id+ selfReferring = Rank2.cotraverse nonTerminal id fixGrammar = ($ selfReferring) recursive = id
src/Text/Grampa/ContextFree/LeftRecursive.hs view
@@ -70,7 +70,7 @@ -- mempty = Union (Rank2.pure $ Const False) instance (Rank2.Apply g, Rank2.Distributive g) => Monoid (Union g) where- mempty = Union (Rank2.distributeWith (Const . getConst) (Const False))+ mempty = Union (Rank2.cotraverse (Const . getConst) (Const False)) mappend (Union g1) (Union g2) = Union (Rank2.liftA2 union g1 g2) general, general' :: Alternative (p g s) => Fixed p g s a -> Fixed p g s a