parser-combinators 1.0.1 → 1.0.2
raw patch · 3 files changed
+18/−3 lines, 3 files
Files
- CHANGELOG.md +7/−0
- Control/Applicative/Permutations.hs +9/−1
- parser-combinators.cabal +2/−2
CHANGELOG.md view
@@ -1,3 +1,10 @@+## Parser combinators 1.0.2++* Defined `liftA2` for `Permutation` manually. The new definition should be+ more efficient.++* Made inner `Maybe` field in `Permutation` strict.+ ## Parser combinators 1.0.1 * Cosmetic changes in the source code.
Control/Applicative/Permutations.hs view
@@ -40,6 +40,8 @@ -- -- @since 0.2.0 +{-# LANGUAGE CPP #-}+ module Control.Applicative.Permutations ( -- ** Permutation type Permutation@@ -55,7 +57,7 @@ -- | An 'Applicative' wrapper-type for constructing permutation parsers. -data Permutation m a = P (Maybe a) (m (Permutation m a))+data Permutation m a = P !(Maybe a) (m (Permutation m a)) instance Functor m => Functor (Permutation m) where fmap f (P v p) = P (f <$> v) (fmap f <$> p)@@ -66,6 +68,12 @@ where lhsAlt = (<*> rhs) <$> v rhsAlt = (lhs <*>) <$> w+#if MIN_VERSION_base(4,10,0)+ liftA2 f lhs@(P x v) rhs@(P y w) = P (liftA2 f x y) (lhsAlt <|> rhsAlt)+ where+ lhsAlt = (\p -> liftA2 f p rhs) <$> v+ rhsAlt = liftA2 f lhs <$> w+#endif -- | \"Unlifts\" a permutation parser into a parser to be evaluated.
parser-combinators.cabal view
@@ -1,7 +1,7 @@ name: parser-combinators-version: 1.0.1+version: 1.0.2 cabal-version: 1.18-tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.3+tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.4 license: BSD3 license-file: LICENSE.md author: Mark Karpov <markkarpov92@gmail.com>