From c528eb24ca367ff5fee7835116630bc1f5aa893e Mon Sep 17 00:00:00 2001 From: Denis Redozubov Date: Tue, 1 Mar 2016 14:21:21 +0300 Subject: [PATCH] use base-compat --- servant/servant.cabal | 1 + servant/src/Servant/API/Alternative.hs | 7 ++----- servant/src/Servant/API/ContentTypes.hs | 8 +++----- servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs | 1 - servant/src/Servant/API/ResponseHeaders.hs | 4 +--- servant/src/Servant/Utils/Links.hs | 6 +----- stack-ghc-7.8.4.yaml | 1 + 7 files changed, 9 insertions(+), 19 deletions(-) diff --git a/servant/servant.cabal b/servant/servant.cabal index a66efbce..689fc0fb 100644 --- a/servant/servant.cabal +++ b/servant/servant.cabal @@ -47,6 +47,7 @@ library Servant.Utils.Links build-depends: base >=4.7 && <5 + , base-compat >= 0.8 , aeson >= 0.7 , attoparsec >= 0.12 , bytestring == 0.10.* diff --git a/servant/src/Servant/API/Alternative.hs b/servant/src/Servant/API/Alternative.hs index 752dcef0..144f8b48 100644 --- a/servant/src/Servant/API/Alternative.hs +++ b/servant/src/Servant/API/Alternative.hs @@ -9,12 +9,9 @@ {-# OPTIONS_HADDOCK not-home #-} module Servant.API.Alternative ((:<|>)(..)) where -#if !MIN_VERSION_base(4,8,0) -import Data.Monoid (Monoid (..)) -import Data.Traversable (Traversable) -import Data.Foldable (Foldable) -#endif import Data.Typeable (Typeable) +import Prelude.Compat (Monoid(..), Traversable, Foldable) + -- | Union of two APIs, first takes precedence in case of overlap. -- -- Example: diff --git a/servant/src/Servant/API/ContentTypes.hs b/servant/src/Servant/API/ContentTypes.hs index 61bf1ce9..1e0febdb 100644 --- a/servant/src/Servant/API/ContentTypes.hs +++ b/servant/src/Servant/API/ContentTypes.hs @@ -72,11 +72,8 @@ module Servant.API.ContentTypes , canHandleAcceptH ) where -#if !MIN_VERSION_base(4,8,0) -import Control.Applicative ((*>), (<*)) -#endif import Control.Arrow (left) -import Control.Monad +import Control.Monad.Compat hiding (mapM) import Data.Aeson (FromJSON(..), ToJSON(..), encode) import Data.Aeson.Parser (value) import Data.Aeson.Types (parseEither) @@ -88,7 +85,7 @@ import Data.ByteString.Lazy (ByteString, fromStrict, import qualified Data.ByteString.Lazy as B import qualified Data.ByteString.Lazy.Char8 as BC import Data.Maybe (isJust) -import Data.Monoid +import Data.Monoid.Compat import Data.String.Conversions (cs) import qualified Data.Text as TextS import qualified Data.Text.Encoding as TextS @@ -99,6 +96,7 @@ import GHC.Generics (Generic) import qualified Network.HTTP.Media as M import Network.URI (escapeURIString, isUnreserved, unEscapeString) +import Prelude.Compat ((<*), (*>)) -- * Provided content types data JSON deriving Typeable diff --git a/servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs b/servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs index 91d01727..22d69263 100644 --- a/servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs +++ b/servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs @@ -7,7 +7,6 @@ module Servant.API.Internal.Test.ComprehensiveAPI where import Data.Proxy - import Servant.API type GET = Get '[JSON] () diff --git a/servant/src/Servant/API/ResponseHeaders.hs b/servant/src/Servant/API/ResponseHeaders.hs index dc73a8e0..09d567a7 100644 --- a/servant/src/Servant/API/ResponseHeaders.hs +++ b/servant/src/Servant/API/ResponseHeaders.hs @@ -30,9 +30,6 @@ module Servant.API.ResponseHeaders , HList(..) ) where -#if !MIN_VERSION_base(4,8,0) -import Control.Applicative ((<$>)) -#endif import Data.ByteString.Char8 as BS (pack, unlines, init) import Data.ByteString.Conversion (ToByteString, toByteString', FromByteString, fromByteString) @@ -42,6 +39,7 @@ import GHC.TypeLits (KnownSymbol, symbolVal) import qualified Network.HTTP.Types.Header as HTTP import Servant.API.Header (Header (..)) +import Prelude.Compat -- | Response Header objects. You should never need to construct one directly. -- Instead, use 'addHeader'. diff --git a/servant/src/Servant/Utils/Links.hs b/servant/src/Servant/Utils/Links.hs index d83ffc7e..86085fa6 100644 --- a/servant/src/Servant/Utils/Links.hs +++ b/servant/src/Servant/Utils/Links.hs @@ -105,11 +105,7 @@ import Data.List import Data.Proxy ( Proxy(..) ) import qualified Data.Text as Text import qualified Data.ByteString.Char8 as BSC -#if !MIN_VERSION_base(4,8,0) -import Data.Monoid ( Monoid(..), (<>) ) -#else -import Data.Monoid ( (<>) ) -#endif +import Data.Monoid.Compat ( Monoid(..), (<>) ) import Network.URI ( URI(..), escapeURIString, isUnreserved ) import GHC.TypeLits ( KnownSymbol, symbolVal ) import GHC.Exts(Constraint) diff --git a/stack-ghc-7.8.4.yaml b/stack-ghc-7.8.4.yaml index 8aa461d7..679b2b52 100644 --- a/stack-ghc-7.8.4.yaml +++ b/stack-ghc-7.8.4.yaml @@ -12,6 +12,7 @@ packages: - servant-mock/ - servant-server/ extra-deps: +- base-compat-0.9.0 - hspec-2.2.0 - hspec-core-2.2.0 - hspec-discover-2.2.0