Skip to content

Commit da1beba

Browse files
committed
Merge pull request #404 from haskell-servant/base-compat
prefer base-compat to CPP macros
2 parents f5fe9a0 + 460a0c9 commit da1beba

File tree

13 files changed

+36
-40
lines changed

13 files changed

+36
-40
lines changed

servant-js/servant-js.cabal

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ library
4242
Servant.JS.JQuery
4343
Servant.JS.Vanilla
4444
build-depends: base >= 4.5 && <5
45+
, base-compat >= 0.9
4546
, charset >= 0.3
4647
, lens >= 4
4748
, servant-foreign == 0.5.*
@@ -83,6 +84,7 @@ test-suite spec
8384
Servant.JSSpec
8485
Servant.JSSpec.CustomHeaders
8586
build-depends: base
87+
, base-compat
8688
, hspec >= 2.1.8
8789
, hspec-expectations
8890
, language-ecmascript >= 0.16

servant-js/test/Servant/JSSpec.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{-# LANGUAGE CPP #-}
21
{-# LANGUAGE DataKinds #-}
32
{-# LANGUAGE FlexibleInstances #-}
43
{-# LANGUAGE QuasiQuotes #-}
@@ -7,18 +6,18 @@
76
{-# LANGUAGE TypeOperators #-}
87
{-# LANGUAGE OverloadedStrings #-}
98
{-# OPTIONS_GHC -fno-warn-orphans #-}
9+
1010
module Servant.JSSpec where
1111

1212
import Data.Either (isRight)
13-
#if !MIN_VERSION_base(4,8,0)
14-
import Data.Monoid ((<>),mconcat)
15-
#else
16-
import Data.Monoid ((<>))
17-
#endif
13+
import Data.Monoid ()
14+
import Data.Monoid.Compat ((<>))
1815
import Data.Proxy
1916
import Data.Text (Text)
2017
import qualified Data.Text as T
2118
import Language.ECMAScript3.Parser (program, parse)
19+
import Prelude ()
20+
import Prelude.Compat
2221
import Test.Hspec hiding (shouldContain, shouldNotContain)
2322

2423
import Servant.API.Internal.Test.ComprehensiveAPI

servant-server/servant-server.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ library
4747
Servant.Utils.StaticFiles
4848
build-depends:
4949
base >= 4.7 && < 5
50+
, base-compat >= 0.9
5051
, aeson >= 0.7 && < 0.12
5152
, attoparsec >= 0.12 && < 0.14
5253
, base64-bytestring == 1.0.*

servant-server/src/Servant/Server/Internal.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ module Servant.Server.Internal
2222
, module Servant.Server.Internal.ServantErr
2323
) where
2424

25-
#if !MIN_VERSION_base(4,8,0)
26-
import Control.Applicative ((<$>))
27-
#endif
2825
import Control.Monad.Trans.Except (ExceptT)
2926
import qualified Data.ByteString as B
3027
import qualified Data.ByteString.Char8 as BC8
@@ -45,6 +42,8 @@ import Network.Wai (Application, Request, Response,
4542
rawQueryString, remoteHost,
4643
requestHeaders, requestMethod,
4744
responseLBS, vault)
45+
import Prelude ()
46+
import Prelude.Compat
4847
import Web.HttpApiData (FromHttpApiData)
4948
import Web.HttpApiData.Internal (parseHeaderMaybe,
5049
parseQueryParamMaybe,

servant-server/src/Servant/Server/Internal/Enter.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
{-# LANGUAGE UndecidableInstances #-}
1111
module Servant.Server.Internal.Enter where
1212

13-
#if !MIN_VERSION_base(4,8,0)
14-
import Control.Applicative
15-
#endif
1613
import qualified Control.Category as C
1714
#if MIN_VERSION_mtl(2,2,1)
1815
import Control.Monad.Except
@@ -25,6 +22,9 @@ import qualified Control.Monad.State.Strict as SState
2522
import qualified Control.Monad.Writer.Lazy as LWriter
2623
import qualified Control.Monad.Writer.Strict as SWriter
2724
import Data.Typeable
25+
import Prelude ()
26+
import Prelude.Compat
27+
2828
import Servant.API
2929

3030
class Enter typ arg ret | typ arg -> ret, typ ret -> arg where

servant-server/src/Servant/Server/Internal/RoutingApplication.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
{-# LANGUAGE StandaloneDeriving #-}
99
module Servant.Server.Internal.RoutingApplication where
1010

11-
#if !MIN_VERSION_base(4,8,0)
12-
import Control.Applicative ((<$>))
13-
#endif
1411
import Control.Monad.Trans.Except (ExceptT, runExceptT)
1512
import Network.Wai (Application, Request,
1613
Response, ResponseReceived)
14+
import Prelude ()
15+
import Prelude.Compat
1716
import Servant.Server.Internal.ServantErr
1817

1918
type RoutingApplication =

servant/servant.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ library
4747
Servant.Utils.Links
4848
build-depends:
4949
base >=4.7 && <5
50+
, base-compat >= 0.9
5051
, aeson >= 0.7
5152
, attoparsec >= 0.12
5253
, bytestring == 0.10.*

servant/src/Servant/API/Alternative.hs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99
{-# OPTIONS_HADDOCK not-home #-}
1010
module Servant.API.Alternative ((:<|>)(..)) where
1111

12-
#if !MIN_VERSION_base(4,8,0)
13-
import Data.Monoid (Monoid (..))
14-
import Data.Traversable (Traversable)
15-
import Data.Foldable (Foldable)
16-
#endif
1712
import Data.Typeable (Typeable)
13+
import Prelude ()
14+
import Prelude.Compat
15+
1816
-- | Union of two APIs, first takes precedence in case of overlap.
1917
--
2018
-- Example:

servant/src/Servant/API/ContentTypes.hs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,8 @@ module Servant.API.ContentTypes
7272
, canHandleAcceptH
7373
) where
7474

75-
#if !MIN_VERSION_base(4,8,0)
76-
import Control.Applicative ((*>), (<*))
77-
#endif
7875
import Control.Arrow (left)
79-
import Control.Monad
76+
import Control.Monad.Compat
8077
import Data.Aeson (FromJSON(..), ToJSON(..), encode)
8178
import Data.Aeson.Parser (value)
8279
import Data.Aeson.Types (parseEither)
@@ -88,7 +85,7 @@ import Data.ByteString.Lazy (ByteString, fromStrict,
8885
import qualified Data.ByteString.Lazy as B
8986
import qualified Data.ByteString.Lazy.Char8 as BC
9087
import Data.Maybe (isJust)
91-
import Data.Monoid
88+
import Data.Monoid.Compat
9289
import Data.String.Conversions (cs)
9390
import qualified Data.Text as TextS
9491
import qualified Data.Text.Encoding as TextS
@@ -99,6 +96,8 @@ import GHC.Generics (Generic)
9996
import qualified Network.HTTP.Media as M
10097
import Network.URI (escapeURIString,
10198
isUnreserved, unEscapeString)
99+
import Prelude ()
100+
import Prelude.Compat
102101

103102
-- * Provided content types
104103
data JSON deriving Typeable

servant/src/Servant/API/ResponseHeaders.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ module Servant.API.ResponseHeaders
3030
, HList(..)
3131
) where
3232

33-
#if !MIN_VERSION_base(4,8,0)
34-
import Control.Applicative ((<$>))
35-
#endif
3633
import Data.ByteString.Char8 as BS (pack, unlines, init)
3734
import Data.ByteString.Conversion (ToByteString, toByteString',
3835
FromByteString, fromByteString)
@@ -42,6 +39,8 @@ import GHC.TypeLits (KnownSymbol, symbolVal)
4239
import qualified Network.HTTP.Types.Header as HTTP
4340

4441
import Servant.API.Header (Header (..))
42+
import Prelude ()
43+
import Prelude.Compat
4544

4645
-- | Response Header objects. You should never need to construct one directly.
4746
-- Instead, use 'addHeader'.

0 commit comments

Comments
 (0)