From 29824d1089215e9614dfeacbd472aba1f5b4314d Mon Sep 17 00:00:00 2001 From: mrkkrp Date: Sun, 31 Dec 2017 17:04:46 +0700 Subject: [PATCH] =?UTF-8?q?Allow=20=E2=80=98megaparsec-6.4.0=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ Text/URI/Parser/ByteString.hs | 16 ++++++++++------ Text/URI/Parser/Text.hs | 6 +++++- stack.yaml | 3 +++ 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4858beb..ea4c9ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Modern URI 0.1.2.1 + +* Allow Megaparsec 6.4.0. + ## Modern URI 0.1.2.0 * Fixed handling of `+` in query strings. Now `+` is parsed as space and diff --git a/Text/URI/Parser/ByteString.hs b/Text/URI/Parser/ByteString.hs index ea89c41..f9af05d 100644 --- a/Text/URI/Parser/ByteString.hs +++ b/Text/URI/Parser/ByteString.hs @@ -9,17 +9,17 @@ -- -- URI parser for string 'ByteString', an internal module. -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE RecordWildCards #-} module Text.URI.Parser.ByteString ( parserBs ) where -import Control.Applicative import Control.Monad import Control.Monad.Catch (MonadThrow (..)) import Data.ByteString (ByteString) @@ -38,6 +38,10 @@ import qualified Data.Set as E import qualified Data.Text.Encoding as TE import qualified Text.Megaparsec.Byte.Lexer as L +#if !MIN_VERSION_megaparsec(6,4,0) +import Control.Applicative (empty) +#endif + -- | This parser can be used to parse 'URI' from strict 'ByteString'. -- Remember to use a concrete non-polymorphic parser type for efficiency. -- diff --git a/Text/URI/Parser/Text.hs b/Text/URI/Parser/Text.hs index fc20bb0..cdb36ad 100644 --- a/Text/URI/Parser/Text.hs +++ b/Text/URI/Parser/Text.hs @@ -9,6 +9,7 @@ -- -- URI parser for strict 'Text', an internal module. +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} @@ -20,7 +21,6 @@ module Text.URI.Parser.Text , parser ) where -import Control.Applicative import Control.Monad import Control.Monad.Catch (MonadThrow (..)) import Data.Maybe (isJust, catMaybes) @@ -35,6 +35,10 @@ import qualified Data.List.NonEmpty as NE import qualified Data.Text.Encoding as TE import qualified Text.Megaparsec.Char.Lexer as L +#if !MIN_VERSION_megaparsec(6,4,0) +import Control.Applicative (empty) +#endif + -- | Construct a 'URI' from 'Text'. The input you pass to 'mkURI' must be a -- valid URI as per RFC 3986, that is, its components should be -- percent-encoded where necessary. In case of parse failure diff --git a/stack.yaml b/stack.yaml index d3afca8..0bec20d 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,3 +1,6 @@ resolver: lts-10.0 packages: - '.' +extra-deps: +- megaparsec-6.4.0 +- parser-combinators-0.4.0