mirror of
https://github.com/mrkkrp/megaparsec.git
synced 2024-11-24 03:52:07 +03:00
Merge pull request #50 from bkaestner/base-4600
Add base-4.6.0.x compatiblity
This commit is contained in:
commit
9e445f844b
@ -28,7 +28,9 @@ module Text.Megaparsec.Error
|
|||||||
, showMessages )
|
, showMessages )
|
||||||
where
|
where
|
||||||
|
|
||||||
|
#if MIN_VERSION_base(4,7,0)
|
||||||
import Data.Bool (bool)
|
import Data.Bool (bool)
|
||||||
|
#endif
|
||||||
import Data.List (intercalate)
|
import Data.List (intercalate)
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
|
|
||||||
@ -38,6 +40,11 @@ import Text.Megaparsec.Pos
|
|||||||
import Control.Applicative ((<$>))
|
import Control.Applicative ((<$>))
|
||||||
import Data.Foldable (foldMap)
|
import Data.Foldable (foldMap)
|
||||||
#endif
|
#endif
|
||||||
|
#if !MIN_VERSION_base(4,7,0)
|
||||||
|
bool :: a -> a -> Bool -> a
|
||||||
|
bool f _ False = f
|
||||||
|
bool _ t True = t
|
||||||
|
#endif
|
||||||
|
|
||||||
-- | This data type represents parse error messages. There are three kinds
|
-- | This data type represents parse error messages. There are three kinds
|
||||||
-- of messages:
|
-- of messages:
|
||||||
|
@ -40,7 +40,9 @@ module Text.Megaparsec.Prim
|
|||||||
, parseTest )
|
, parseTest )
|
||||||
where
|
where
|
||||||
|
|
||||||
|
#if MIN_VERSION_base(4,7,0)
|
||||||
import Data.Bool (bool)
|
import Data.Bool (bool)
|
||||||
|
#endif
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
|
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
@ -70,6 +72,11 @@ import Text.Megaparsec.ShowToken
|
|||||||
#if !MIN_VERSION_base(4,8,0)
|
#if !MIN_VERSION_base(4,8,0)
|
||||||
import Control.Applicative ((<$>), (<*))
|
import Control.Applicative ((<$>), (<*))
|
||||||
#endif
|
#endif
|
||||||
|
#if !MIN_VERSION_base(4,7,0)
|
||||||
|
bool :: a -> a -> Bool -> a
|
||||||
|
bool f _ False = f
|
||||||
|
bool _ t True = t
|
||||||
|
#endif
|
||||||
|
|
||||||
-- | This is Megaparsec state, it's parametrized over stream type @s@.
|
-- | This is Megaparsec state, it's parametrized over stream type @s@.
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ description:
|
|||||||
extra-source-files: AUTHORS.md, CHANGELOG.md
|
extra-source-files: AUTHORS.md, CHANGELOG.md
|
||||||
|
|
||||||
library
|
library
|
||||||
build-depends: base >= 4.7 && < 5
|
build-depends: base >= 4.6 && < 5
|
||||||
, mtl == 2.*
|
, mtl == 2.*
|
||||||
, transformers == 0.4.*
|
, transformers == 0.4.*
|
||||||
, bytestring
|
, bytestring
|
||||||
@ -122,7 +122,7 @@ test-suite old-tests
|
|||||||
, Bugs.Bug35
|
, Bugs.Bug35
|
||||||
, Bugs.Bug39
|
, Bugs.Bug39
|
||||||
, Util
|
, Util
|
||||||
build-depends: base >= 4.7 && < 5
|
build-depends: base >= 4.6 && < 5
|
||||||
, megaparsec >= 4.0.0
|
, megaparsec >= 4.0.0
|
||||||
, HUnit >= 1.2 && < 1.4
|
, HUnit >= 1.2 && < 1.4
|
||||||
, test-framework >= 0.6 && < 1
|
, test-framework >= 0.6 && < 1
|
||||||
@ -146,7 +146,7 @@ test-suite tests
|
|||||||
, Pos
|
, Pos
|
||||||
, Prim
|
, Prim
|
||||||
, Util
|
, Util
|
||||||
build-depends: base >= 4.7 && < 5
|
build-depends: base >= 4.6 && < 5
|
||||||
, megaparsec >= 4.0.0
|
, megaparsec >= 4.0.0
|
||||||
, mtl == 2.*
|
, mtl == 2.*
|
||||||
, transformers == 0.4.*
|
, transformers == 0.4.*
|
||||||
@ -164,7 +164,7 @@ benchmark benchmarks
|
|||||||
hs-source-dirs: benchmarks
|
hs-source-dirs: benchmarks
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
ghc-options: -O2 -Wall -rtsopts
|
ghc-options: -O2 -Wall -rtsopts
|
||||||
build-depends: base >= 4.7 && < 5
|
build-depends: base >= 4.6 && < 5
|
||||||
, megaparsec >= 4.0.0
|
, megaparsec >= 4.0.0
|
||||||
, criterion >= 0.6.2.1 && < 1.2
|
, criterion >= 0.6.2.1 && < 1.2
|
||||||
, text >= 1.2 && < 2
|
, text >= 1.2 && < 2
|
||||||
|
@ -3,7 +3,9 @@ module Bugs.Bug39 (main) where
|
|||||||
|
|
||||||
import Control.Applicative (empty)
|
import Control.Applicative (empty)
|
||||||
import Control.Monad (void)
|
import Control.Monad (void)
|
||||||
|
#if MIN_VERSION_base(4,7,0)
|
||||||
import Data.Either (isLeft, isRight)
|
import Data.Either (isLeft, isRight)
|
||||||
|
#endif
|
||||||
|
|
||||||
import Text.Megaparsec
|
import Text.Megaparsec
|
||||||
import Text.Megaparsec.String
|
import Text.Megaparsec.String
|
||||||
@ -13,6 +15,14 @@ import Test.Framework
|
|||||||
import Test.Framework.Providers.HUnit
|
import Test.Framework.Providers.HUnit
|
||||||
import Test.HUnit hiding (Test)
|
import Test.HUnit hiding (Test)
|
||||||
|
|
||||||
|
#if !MIN_VERSION_base(4,7,0)
|
||||||
|
isRight, isLeft :: Either a b -> Bool
|
||||||
|
isRight (Right _) = True
|
||||||
|
isRight _ = False
|
||||||
|
isLeft (Left _ ) = True
|
||||||
|
isLeft _ = False
|
||||||
|
#endif
|
||||||
|
|
||||||
shouldFail :: [String]
|
shouldFail :: [String]
|
||||||
shouldFail = [" 1", " +1", " -1"]
|
shouldFail = [" 1", " +1", " -1"]
|
||||||
|
|
||||||
|
@ -31,7 +31,9 @@
|
|||||||
|
|
||||||
module Error (tests) where
|
module Error (tests) where
|
||||||
|
|
||||||
|
#if MIN_VERSION_base(4,7,0)
|
||||||
import Data.Bool (bool)
|
import Data.Bool (bool)
|
||||||
|
#endif
|
||||||
import Data.List (isPrefixOf, isInfixOf)
|
import Data.List (isPrefixOf, isInfixOf)
|
||||||
|
|
||||||
import Test.Framework
|
import Test.Framework
|
||||||
@ -45,6 +47,11 @@ import Text.Megaparsec.Pos
|
|||||||
#if !MIN_VERSION_base(4,8,0)
|
#if !MIN_VERSION_base(4,8,0)
|
||||||
import Control.Applicative ((<$>), (<*>))
|
import Control.Applicative ((<$>), (<*>))
|
||||||
#endif
|
#endif
|
||||||
|
#if !MIN_VERSION_base(4,7,0)
|
||||||
|
bool :: a -> a -> Bool -> a
|
||||||
|
bool f _ False = f
|
||||||
|
bool _ t True = t
|
||||||
|
#endif
|
||||||
|
|
||||||
tests :: Test
|
tests :: Test
|
||||||
tests = testGroup "Parse errors"
|
tests = testGroup "Parse errors"
|
||||||
|
@ -30,7 +30,9 @@
|
|||||||
module Expr (tests) where
|
module Expr (tests) where
|
||||||
|
|
||||||
import Control.Applicative (some, (<|>))
|
import Control.Applicative (some, (<|>))
|
||||||
|
#if MIN_VERSION_base(4,7,0)
|
||||||
import Data.Bool (bool)
|
import Data.Bool (bool)
|
||||||
|
#endif
|
||||||
|
|
||||||
import Test.Framework
|
import Test.Framework
|
||||||
import Test.Framework.Providers.QuickCheck2 (testProperty)
|
import Test.Framework.Providers.QuickCheck2 (testProperty)
|
||||||
@ -47,6 +49,12 @@ import Util
|
|||||||
import Control.Applicative ((<$>), (<*), (<*>), (*>), pure)
|
import Control.Applicative ((<$>), (<*), (<*>), (*>), pure)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !MIN_VERSION_base(4,7,0)
|
||||||
|
bool :: a -> a -> Bool -> a
|
||||||
|
bool f _ False = f
|
||||||
|
bool _ t True = t
|
||||||
|
#endif
|
||||||
|
|
||||||
tests :: Test
|
tests :: Test
|
||||||
tests = testGroup "Expression parsers"
|
tests = testGroup "Expression parsers"
|
||||||
[ testProperty "correctness of expression parser" prop_correctness ]
|
[ testProperty "correctness of expression parser" prop_correctness ]
|
||||||
|
@ -31,7 +31,9 @@ module Lexer (tests) where
|
|||||||
|
|
||||||
import Control.Applicative (empty)
|
import Control.Applicative (empty)
|
||||||
import Control.Monad (void)
|
import Control.Monad (void)
|
||||||
|
#if MIN_VERSION_base(4,7,0)
|
||||||
import Data.Bool (bool)
|
import Data.Bool (bool)
|
||||||
|
#endif
|
||||||
import Data.Char
|
import Data.Char
|
||||||
( readLitChar
|
( readLitChar
|
||||||
, showLitChar
|
, showLitChar
|
||||||
@ -59,6 +61,11 @@ import Util
|
|||||||
#if !MIN_VERSION_base(4,8,0)
|
#if !MIN_VERSION_base(4,8,0)
|
||||||
import Control.Applicative ((<$>), (<*), (<*>))
|
import Control.Applicative ((<$>), (<*), (<*>))
|
||||||
#endif
|
#endif
|
||||||
|
#if !MIN_VERSION_base(4,7,0)
|
||||||
|
bool :: a -> a -> Bool -> a
|
||||||
|
bool f _ False = f
|
||||||
|
bool _ t True = t
|
||||||
|
#endif
|
||||||
|
|
||||||
tests :: Test
|
tests :: Test
|
||||||
tests = testGroup "Lexer"
|
tests = testGroup "Lexer"
|
||||||
|
@ -30,7 +30,9 @@
|
|||||||
module Perm (tests) where
|
module Perm (tests) where
|
||||||
|
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
|
#if MIN_VERSION_base(4,7,0)
|
||||||
import Data.Bool (bool)
|
import Data.Bool (bool)
|
||||||
|
#endif
|
||||||
import Data.List (nub, elemIndices)
|
import Data.List (nub, elemIndices)
|
||||||
|
|
||||||
import Test.Framework
|
import Test.Framework
|
||||||
@ -41,6 +43,11 @@ import Text.Megaparsec.Char
|
|||||||
import Text.Megaparsec.Perm
|
import Text.Megaparsec.Perm
|
||||||
|
|
||||||
import Util
|
import Util
|
||||||
|
#if !MIN_VERSION_base(4,7,0)
|
||||||
|
bool :: a -> a -> Bool -> a
|
||||||
|
bool f _ False = f
|
||||||
|
bool _ t True = t
|
||||||
|
#endif
|
||||||
|
|
||||||
tests :: Test
|
tests :: Test
|
||||||
tests = testGroup "Permutation phrases parsers"
|
tests = testGroup "Permutation phrases parsers"
|
||||||
|
@ -32,7 +32,9 @@
|
|||||||
module Prim (tests) where
|
module Prim (tests) where
|
||||||
|
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
|
#if MIN_VERSION_base(4,7,0)
|
||||||
import Data.Bool (bool)
|
import Data.Bool (bool)
|
||||||
|
#endif
|
||||||
import Data.Char (isLetter, toUpper)
|
import Data.Char (isLetter, toUpper)
|
||||||
import Data.Foldable (asum)
|
import Data.Foldable (asum)
|
||||||
import Data.List (isPrefixOf)
|
import Data.List (isPrefixOf)
|
||||||
@ -57,6 +59,11 @@ import Text.Megaparsec.String
|
|||||||
|
|
||||||
import Pos ()
|
import Pos ()
|
||||||
import Util
|
import Util
|
||||||
|
#if !MIN_VERSION_base(4,7,0)
|
||||||
|
bool :: a -> a -> Bool -> a
|
||||||
|
bool f _ False = f
|
||||||
|
bool _ t True = t
|
||||||
|
#endif
|
||||||
|
|
||||||
tests :: Test
|
tests :: Test
|
||||||
tests = testGroup "Primitive parser combinators"
|
tests = testGroup "Primitive parser combinators"
|
||||||
|
Loading…
Reference in New Issue
Block a user