Merge pull request #404 from haskell-servant/base-compat
prefer base-compat to CPP macros
This commit is contained in:
commit
da1beba7f4
13 changed files with 36 additions and 40 deletions
|
@ -42,6 +42,7 @@ library
|
||||||
Servant.JS.JQuery
|
Servant.JS.JQuery
|
||||||
Servant.JS.Vanilla
|
Servant.JS.Vanilla
|
||||||
build-depends: base >= 4.5 && <5
|
build-depends: base >= 4.5 && <5
|
||||||
|
, base-compat >= 0.9
|
||||||
, charset >= 0.3
|
, charset >= 0.3
|
||||||
, lens >= 4
|
, lens >= 4
|
||||||
, servant-foreign == 0.5.*
|
, servant-foreign == 0.5.*
|
||||||
|
@ -83,6 +84,7 @@ test-suite spec
|
||||||
Servant.JSSpec
|
Servant.JSSpec
|
||||||
Servant.JSSpec.CustomHeaders
|
Servant.JSSpec.CustomHeaders
|
||||||
build-depends: base
|
build-depends: base
|
||||||
|
, base-compat
|
||||||
, hspec >= 2.1.8
|
, hspec >= 2.1.8
|
||||||
, hspec-expectations
|
, hspec-expectations
|
||||||
, language-ecmascript >= 0.16
|
, language-ecmascript >= 0.16
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
{-# LANGUAGE CPP #-}
|
|
||||||
{-# LANGUAGE DataKinds #-}
|
{-# LANGUAGE DataKinds #-}
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
|
@ -7,18 +6,18 @@
|
||||||
{-# LANGUAGE TypeOperators #-}
|
{-# LANGUAGE TypeOperators #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
|
||||||
module Servant.JSSpec where
|
module Servant.JSSpec where
|
||||||
|
|
||||||
import Data.Either (isRight)
|
import Data.Either (isRight)
|
||||||
#if !MIN_VERSION_base(4,8,0)
|
import Data.Monoid ()
|
||||||
import Data.Monoid ((<>),mconcat)
|
import Data.Monoid.Compat ((<>))
|
||||||
#else
|
|
||||||
import Data.Monoid ((<>))
|
|
||||||
#endif
|
|
||||||
import Data.Proxy
|
import Data.Proxy
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Language.ECMAScript3.Parser (program, parse)
|
import Language.ECMAScript3.Parser (program, parse)
|
||||||
|
import Prelude ()
|
||||||
|
import Prelude.Compat
|
||||||
import Test.Hspec hiding (shouldContain, shouldNotContain)
|
import Test.Hspec hiding (shouldContain, shouldNotContain)
|
||||||
|
|
||||||
import Servant.API.Internal.Test.ComprehensiveAPI
|
import Servant.API.Internal.Test.ComprehensiveAPI
|
||||||
|
|
|
@ -47,6 +47,7 @@ library
|
||||||
Servant.Utils.StaticFiles
|
Servant.Utils.StaticFiles
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.7 && < 5
|
base >= 4.7 && < 5
|
||||||
|
, base-compat >= 0.9
|
||||||
, aeson >= 0.7 && < 0.12
|
, aeson >= 0.7 && < 0.12
|
||||||
, attoparsec >= 0.12 && < 0.14
|
, attoparsec >= 0.12 && < 0.14
|
||||||
, base64-bytestring == 1.0.*
|
, base64-bytestring == 1.0.*
|
||||||
|
|
|
@ -22,9 +22,6 @@ module Servant.Server.Internal
|
||||||
, module Servant.Server.Internal.ServantErr
|
, module Servant.Server.Internal.ServantErr
|
||||||
) where
|
) where
|
||||||
|
|
||||||
#if !MIN_VERSION_base(4,8,0)
|
|
||||||
import Control.Applicative ((<$>))
|
|
||||||
#endif
|
|
||||||
import Control.Monad.Trans.Except (ExceptT)
|
import Control.Monad.Trans.Except (ExceptT)
|
||||||
import qualified Data.ByteString as B
|
import qualified Data.ByteString as B
|
||||||
import qualified Data.ByteString.Char8 as BC8
|
import qualified Data.ByteString.Char8 as BC8
|
||||||
|
@ -45,6 +42,8 @@ import Network.Wai (Application, Request, Response,
|
||||||
rawQueryString, remoteHost,
|
rawQueryString, remoteHost,
|
||||||
requestHeaders, requestMethod,
|
requestHeaders, requestMethod,
|
||||||
responseLBS, vault)
|
responseLBS, vault)
|
||||||
|
import Prelude ()
|
||||||
|
import Prelude.Compat
|
||||||
import Web.HttpApiData (FromHttpApiData)
|
import Web.HttpApiData (FromHttpApiData)
|
||||||
import Web.HttpApiData.Internal (parseHeaderMaybe,
|
import Web.HttpApiData.Internal (parseHeaderMaybe,
|
||||||
parseQueryParamMaybe,
|
parseQueryParamMaybe,
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
{-# LANGUAGE UndecidableInstances #-}
|
{-# LANGUAGE UndecidableInstances #-}
|
||||||
module Servant.Server.Internal.Enter where
|
module Servant.Server.Internal.Enter where
|
||||||
|
|
||||||
#if !MIN_VERSION_base(4,8,0)
|
|
||||||
import Control.Applicative
|
|
||||||
#endif
|
|
||||||
import qualified Control.Category as C
|
import qualified Control.Category as C
|
||||||
#if MIN_VERSION_mtl(2,2,1)
|
#if MIN_VERSION_mtl(2,2,1)
|
||||||
import Control.Monad.Except
|
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.Lazy as LWriter
|
||||||
import qualified Control.Monad.Writer.Strict as SWriter
|
import qualified Control.Monad.Writer.Strict as SWriter
|
||||||
import Data.Typeable
|
import Data.Typeable
|
||||||
|
import Prelude ()
|
||||||
|
import Prelude.Compat
|
||||||
|
|
||||||
import Servant.API
|
import Servant.API
|
||||||
|
|
||||||
class Enter typ arg ret | typ arg -> ret, typ ret -> arg where
|
class Enter typ arg ret | typ arg -> ret, typ ret -> arg where
|
||||||
|
|
|
@ -8,12 +8,11 @@
|
||||||
{-# LANGUAGE StandaloneDeriving #-}
|
{-# LANGUAGE StandaloneDeriving #-}
|
||||||
module Servant.Server.Internal.RoutingApplication where
|
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 Control.Monad.Trans.Except (ExceptT, runExceptT)
|
||||||
import Network.Wai (Application, Request,
|
import Network.Wai (Application, Request,
|
||||||
Response, ResponseReceived)
|
Response, ResponseReceived)
|
||||||
|
import Prelude ()
|
||||||
|
import Prelude.Compat
|
||||||
import Servant.Server.Internal.ServantErr
|
import Servant.Server.Internal.ServantErr
|
||||||
|
|
||||||
type RoutingApplication =
|
type RoutingApplication =
|
||||||
|
|
|
@ -47,6 +47,7 @@ library
|
||||||
Servant.Utils.Links
|
Servant.Utils.Links
|
||||||
build-depends:
|
build-depends:
|
||||||
base >=4.7 && <5
|
base >=4.7 && <5
|
||||||
|
, base-compat >= 0.9
|
||||||
, aeson >= 0.7
|
, aeson >= 0.7
|
||||||
, attoparsec >= 0.12
|
, attoparsec >= 0.12
|
||||||
, bytestring == 0.10.*
|
, bytestring == 0.10.*
|
||||||
|
|
|
@ -9,12 +9,10 @@
|
||||||
{-# OPTIONS_HADDOCK not-home #-}
|
{-# OPTIONS_HADDOCK not-home #-}
|
||||||
module Servant.API.Alternative ((:<|>)(..)) where
|
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 Data.Typeable (Typeable)
|
||||||
|
import Prelude ()
|
||||||
|
import Prelude.Compat
|
||||||
|
|
||||||
-- | Union of two APIs, first takes precedence in case of overlap.
|
-- | Union of two APIs, first takes precedence in case of overlap.
|
||||||
--
|
--
|
||||||
-- Example:
|
-- Example:
|
||||||
|
|
|
@ -72,11 +72,8 @@ module Servant.API.ContentTypes
|
||||||
, canHandleAcceptH
|
, canHandleAcceptH
|
||||||
) where
|
) where
|
||||||
|
|
||||||
#if !MIN_VERSION_base(4,8,0)
|
|
||||||
import Control.Applicative ((*>), (<*))
|
|
||||||
#endif
|
|
||||||
import Control.Arrow (left)
|
import Control.Arrow (left)
|
||||||
import Control.Monad
|
import Control.Monad.Compat
|
||||||
import Data.Aeson (FromJSON(..), ToJSON(..), encode)
|
import Data.Aeson (FromJSON(..), ToJSON(..), encode)
|
||||||
import Data.Aeson.Parser (value)
|
import Data.Aeson.Parser (value)
|
||||||
import Data.Aeson.Types (parseEither)
|
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 as B
|
||||||
import qualified Data.ByteString.Lazy.Char8 as BC
|
import qualified Data.ByteString.Lazy.Char8 as BC
|
||||||
import Data.Maybe (isJust)
|
import Data.Maybe (isJust)
|
||||||
import Data.Monoid
|
import Data.Monoid.Compat
|
||||||
import Data.String.Conversions (cs)
|
import Data.String.Conversions (cs)
|
||||||
import qualified Data.Text as TextS
|
import qualified Data.Text as TextS
|
||||||
import qualified Data.Text.Encoding 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 qualified Network.HTTP.Media as M
|
||||||
import Network.URI (escapeURIString,
|
import Network.URI (escapeURIString,
|
||||||
isUnreserved, unEscapeString)
|
isUnreserved, unEscapeString)
|
||||||
|
import Prelude ()
|
||||||
|
import Prelude.Compat
|
||||||
|
|
||||||
-- * Provided content types
|
-- * Provided content types
|
||||||
data JSON deriving Typeable
|
data JSON deriving Typeable
|
||||||
|
|
|
@ -30,9 +30,6 @@ module Servant.API.ResponseHeaders
|
||||||
, HList(..)
|
, HList(..)
|
||||||
) where
|
) where
|
||||||
|
|
||||||
#if !MIN_VERSION_base(4,8,0)
|
|
||||||
import Control.Applicative ((<$>))
|
|
||||||
#endif
|
|
||||||
import Data.ByteString.Char8 as BS (pack, unlines, init)
|
import Data.ByteString.Char8 as BS (pack, unlines, init)
|
||||||
import Data.ByteString.Conversion (ToByteString, toByteString',
|
import Data.ByteString.Conversion (ToByteString, toByteString',
|
||||||
FromByteString, fromByteString)
|
FromByteString, fromByteString)
|
||||||
|
@ -42,6 +39,8 @@ import GHC.TypeLits (KnownSymbol, symbolVal)
|
||||||
import qualified Network.HTTP.Types.Header as HTTP
|
import qualified Network.HTTP.Types.Header as HTTP
|
||||||
|
|
||||||
import Servant.API.Header (Header (..))
|
import Servant.API.Header (Header (..))
|
||||||
|
import Prelude ()
|
||||||
|
import Prelude.Compat
|
||||||
|
|
||||||
-- | Response Header objects. You should never need to construct one directly.
|
-- | Response Header objects. You should never need to construct one directly.
|
||||||
-- Instead, use 'addHeader'.
|
-- Instead, use 'addHeader'.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
{-# LANGUAGE CPP #-}
|
|
||||||
{-# LANGUAGE ConstraintKinds #-}
|
{-# LANGUAGE ConstraintKinds #-}
|
||||||
{-# LANGUAGE DataKinds #-}
|
{-# LANGUAGE DataKinds #-}
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
|
@ -101,18 +100,16 @@ module Servant.Utils.Links (
|
||||||
, Or
|
, Or
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Data.List
|
|
||||||
import Data.Proxy ( Proxy(..) )
|
|
||||||
import qualified Data.Text as Text
|
|
||||||
import qualified Data.ByteString.Char8 as BSC
|
import qualified Data.ByteString.Char8 as BSC
|
||||||
#if !MIN_VERSION_base(4,8,0)
|
import Data.List
|
||||||
import Data.Monoid ( Monoid(..), (<>) )
|
import Data.Monoid.Compat ( (<>) )
|
||||||
#else
|
import Data.Proxy ( Proxy(..) )
|
||||||
import Data.Monoid ( (<>) )
|
import qualified Data.Text as Text
|
||||||
#endif
|
import GHC.Exts (Constraint)
|
||||||
import Network.URI ( URI(..), escapeURIString, isUnreserved )
|
import GHC.TypeLits ( KnownSymbol, symbolVal )
|
||||||
import GHC.TypeLits ( KnownSymbol, symbolVal )
|
import Network.URI ( URI(..), escapeURIString, isUnreserved )
|
||||||
import GHC.Exts(Constraint)
|
import Prelude ()
|
||||||
|
import Prelude.Compat
|
||||||
|
|
||||||
import Web.HttpApiData
|
import Web.HttpApiData
|
||||||
import Servant.API.Capture ( Capture )
|
import Servant.API.Capture ( Capture )
|
||||||
|
|
|
@ -12,6 +12,7 @@ packages:
|
||||||
- servant-mock/
|
- servant-mock/
|
||||||
- servant-server/
|
- servant-server/
|
||||||
extra-deps:
|
extra-deps:
|
||||||
|
- base-compat-0.9.0
|
||||||
- hspec-2.2.0
|
- hspec-2.2.0
|
||||||
- hspec-core-2.2.0
|
- hspec-core-2.2.0
|
||||||
- hspec-discover-2.2.0
|
- hspec-discover-2.2.0
|
||||||
|
|
|
@ -14,6 +14,7 @@ packages:
|
||||||
- servant-mock/
|
- servant-mock/
|
||||||
- servant-server/
|
- servant-server/
|
||||||
extra-deps:
|
extra-deps:
|
||||||
|
- base-compat-0.9.0
|
||||||
- engine-io-wai-1.0.2
|
- engine-io-wai-1.0.2
|
||||||
- control-monad-omega-0.3.1
|
- control-monad-omega-0.3.1
|
||||||
- should-not-typecheck-2.0.1
|
- should-not-typecheck-2.0.1
|
||||||
|
|
Loading…
Reference in a new issue