Merge pull request #404 from haskell-servant/base-compat

prefer base-compat to CPP macros
This commit is contained in:
Julian Arni 2016-03-18 13:53:13 +01:00
commit da1beba7f4
13 changed files with 36 additions and 40 deletions

View file

@ -42,6 +42,7 @@ library
Servant.JS.JQuery
Servant.JS.Vanilla
build-depends: base >= 4.5 && <5
, base-compat >= 0.9
, charset >= 0.3
, lens >= 4
, servant-foreign == 0.5.*
@ -83,6 +84,7 @@ test-suite spec
Servant.JSSpec
Servant.JSSpec.CustomHeaders
build-depends: base
, base-compat
, hspec >= 2.1.8
, hspec-expectations
, language-ecmascript >= 0.16

View file

@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE QuasiQuotes #-}
@ -7,18 +6,18 @@
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Servant.JSSpec where
import Data.Either (isRight)
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid ((<>),mconcat)
#else
import Data.Monoid ((<>))
#endif
import Data.Monoid ()
import Data.Monoid.Compat ((<>))
import Data.Proxy
import Data.Text (Text)
import qualified Data.Text as T
import Language.ECMAScript3.Parser (program, parse)
import Prelude ()
import Prelude.Compat
import Test.Hspec hiding (shouldContain, shouldNotContain)
import Servant.API.Internal.Test.ComprehensiveAPI

View file

@ -47,6 +47,7 @@ library
Servant.Utils.StaticFiles
build-depends:
base >= 4.7 && < 5
, base-compat >= 0.9
, aeson >= 0.7 && < 0.12
, attoparsec >= 0.12 && < 0.14
, base64-bytestring == 1.0.*

View file

@ -22,9 +22,6 @@ module Servant.Server.Internal
, module Servant.Server.Internal.ServantErr
) where
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative ((<$>))
#endif
import Control.Monad.Trans.Except (ExceptT)
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as BC8
@ -45,6 +42,8 @@ import Network.Wai (Application, Request, Response,
rawQueryString, remoteHost,
requestHeaders, requestMethod,
responseLBS, vault)
import Prelude ()
import Prelude.Compat
import Web.HttpApiData (FromHttpApiData)
import Web.HttpApiData.Internal (parseHeaderMaybe,
parseQueryParamMaybe,

View file

@ -10,9 +10,6 @@
{-# LANGUAGE UndecidableInstances #-}
module Servant.Server.Internal.Enter where
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative
#endif
import qualified Control.Category as C
#if MIN_VERSION_mtl(2,2,1)
import Control.Monad.Except
@ -25,6 +22,9 @@ import qualified Control.Monad.State.Strict as SState
import qualified Control.Monad.Writer.Lazy as LWriter
import qualified Control.Monad.Writer.Strict as SWriter
import Data.Typeable
import Prelude ()
import Prelude.Compat
import Servant.API
class Enter typ arg ret | typ arg -> ret, typ ret -> arg where

View file

@ -8,12 +8,11 @@
{-# LANGUAGE StandaloneDeriving #-}
module Servant.Server.Internal.RoutingApplication where
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative ((<$>))
#endif
import Control.Monad.Trans.Except (ExceptT, runExceptT)
import Network.Wai (Application, Request,
Response, ResponseReceived)
import Prelude ()
import Prelude.Compat
import Servant.Server.Internal.ServantErr
type RoutingApplication =

View file

@ -47,6 +47,7 @@ library
Servant.Utils.Links
build-depends:
base >=4.7 && <5
, base-compat >= 0.9
, aeson >= 0.7
, attoparsec >= 0.12
, bytestring == 0.10.*

View file

@ -9,12 +9,10 @@
{-# 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 ()
import Prelude.Compat
-- | Union of two APIs, first takes precedence in case of overlap.
--
-- Example:

View file

@ -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
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,8 @@ import GHC.Generics (Generic)
import qualified Network.HTTP.Media as M
import Network.URI (escapeURIString,
isUnreserved, unEscapeString)
import Prelude ()
import Prelude.Compat
-- * Provided content types
data JSON deriving Typeable

View file

@ -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,8 @@ import GHC.TypeLits (KnownSymbol, symbolVal)
import qualified Network.HTTP.Types.Header as HTTP
import Servant.API.Header (Header (..))
import Prelude ()
import Prelude.Compat
-- | Response Header objects. You should never need to construct one directly.
-- Instead, use 'addHeader'.

View file

@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
@ -101,18 +100,16 @@ module Servant.Utils.Links (
, Or
) where
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 Network.URI ( URI(..), escapeURIString, isUnreserved )
import GHC.TypeLits ( KnownSymbol, symbolVal )
import GHC.Exts(Constraint)
import Data.List
import Data.Monoid.Compat ( (<>) )
import Data.Proxy ( Proxy(..) )
import qualified Data.Text as Text
import GHC.Exts (Constraint)
import GHC.TypeLits ( KnownSymbol, symbolVal )
import Network.URI ( URI(..), escapeURIString, isUnreserved )
import Prelude ()
import Prelude.Compat
import Web.HttpApiData
import Servant.API.Capture ( Capture )

View file

@ -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

View file

@ -14,6 +14,7 @@ packages:
- servant-mock/
- servant-server/
extra-deps:
- base-compat-0.9.0
- engine-io-wai-1.0.2
- control-monad-omega-0.3.1
- should-not-typecheck-2.0.1