Ghc 8.2 fixes
This commit is contained in:
parent
da8337809b
commit
39ad465695
6 changed files with 18 additions and 13 deletions
|
@ -44,11 +44,14 @@ library
|
||||||
, http-api-data >= 0.3.6 && < 0.4
|
, http-api-data >= 0.3.6 && < 0.4
|
||||||
, http-media >= 0.6.2 && < 0.8
|
, http-media >= 0.6.2 && < 0.8
|
||||||
, http-types >= 0.8.6 && < 0.10
|
, http-types >= 0.8.6 && < 0.10
|
||||||
, mtl >= 2.2 && < 2.3
|
, mtl >= 2.1 && < 2.3
|
||||||
, network-uri >= 2.6 && < 2.7
|
, network-uri >= 2.6 && < 2.7
|
||||||
, safe >= 0.3.9 && < 0.4
|
, safe >= 0.3.9 && < 0.4
|
||||||
, servant == 0.11.*
|
, servant == 0.11.*
|
||||||
, text >= 1.2 && < 1.3
|
, text >= 1.2 && < 1.3
|
||||||
|
if !impl(ghc >= 8.0)
|
||||||
|
build-depends:
|
||||||
|
semigroups >=0.16.2.2 && <0.19
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
@ -66,6 +69,6 @@ test-suite spec
|
||||||
, deepseq
|
, deepseq
|
||||||
, servant-client-core
|
, servant-client-core
|
||||||
, hspec == 2.*
|
, hspec == 2.*
|
||||||
, QuickCheck >= 2.7 && < 2.10
|
, QuickCheck >= 2.7 && < 2.11
|
||||||
other-modules:
|
other-modules:
|
||||||
Servant.Client.Core.Internal.BaseUrlSpec
|
Servant.Client.Core.Internal.BaseUrlSpec
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include "overlapping-compat.h"
|
#include "overlapping-compat.h"
|
||||||
module Servant.Client.Core.Internal.HasClient where
|
module Servant.Client.Core.Internal.HasClient where
|
||||||
|
|
||||||
|
import Prelude.Compat
|
||||||
|
import Prelude ()
|
||||||
|
|
||||||
import Control.Monad.Error.Class (throwError)
|
import Control.Monad.Error.Class (throwError)
|
||||||
import Data.List (foldl')
|
import Data.List (foldl')
|
||||||
|
@ -23,8 +25,6 @@ import Data.Text (pack)
|
||||||
import GHC.Exts (fromList, toList)
|
import GHC.Exts (fromList, toList)
|
||||||
import GHC.TypeLits (KnownSymbol, symbolVal)
|
import GHC.TypeLits (KnownSymbol, symbolVal)
|
||||||
import qualified Network.HTTP.Types as H
|
import qualified Network.HTTP.Types as H
|
||||||
import Prelude ()
|
|
||||||
import Prelude.Compat
|
|
||||||
import Servant.API ((:<|>) ((:<|>)), (:>),
|
import Servant.API ((:<|>) ((:<|>)), (:>),
|
||||||
AuthProtect, BasicAuth,
|
AuthProtect, BasicAuth,
|
||||||
BasicAuthData,
|
BasicAuthData,
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
-- | Types for possible backends to run client-side `Request` queries
|
-- | Types for possible backends to run client-side `Request` queries
|
||||||
module Servant.Client.Core.Internal.RunClient where
|
module Servant.Client.Core.Internal.RunClient where
|
||||||
|
|
||||||
|
import Prelude.Compat
|
||||||
|
import Prelude ()
|
||||||
|
|
||||||
import Control.Monad (unless)
|
import Control.Monad (unless)
|
||||||
import Control.Monad.Error.Class (MonadError, throwError)
|
import Control.Monad.Error.Class (MonadError, throwError)
|
||||||
|
import Data.Foldable (toList)
|
||||||
import Data.Proxy (Proxy)
|
import Data.Proxy (Proxy)
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Network.HTTP.Media (MediaType, matches,
|
import Network.HTTP.Media (MediaType, matches,
|
||||||
|
@ -17,7 +21,6 @@ import Servant.API (MimeUnrender,
|
||||||
mimeUnrender)
|
mimeUnrender)
|
||||||
import Servant.Client.Core.Internal.Request (Request, Response (..),
|
import Servant.Client.Core.Internal.Request (Request, Response (..),
|
||||||
ServantError (..))
|
ServantError (..))
|
||||||
import Data.Foldable (toList)
|
|
||||||
|
|
||||||
class (MonadError ServantError m) => RunClient m where
|
class (MonadError ServantError m) => RunClient m where
|
||||||
-- | How to make a request.
|
-- | How to make a request.
|
||||||
|
@ -26,10 +29,10 @@ class (MonadError ServantError m) => RunClient m where
|
||||||
checkContentTypeHeader :: RunClient m => Response -> m MediaType
|
checkContentTypeHeader :: RunClient m => Response -> m MediaType
|
||||||
checkContentTypeHeader response =
|
checkContentTypeHeader response =
|
||||||
case lookup "Content-Type" $ toList $ responseHeaders response of
|
case lookup "Content-Type" $ toList $ responseHeaders response of
|
||||||
Nothing -> pure $ "application"//"octet-stream"
|
Nothing -> return $ "application"//"octet-stream"
|
||||||
Just t -> case parseAccept t of
|
Just t -> case parseAccept t of
|
||||||
Nothing -> throwError $ InvalidContentTypeHeader response
|
Nothing -> throwError $ InvalidContentTypeHeader response
|
||||||
Just t' -> pure t'
|
Just t' -> return t'
|
||||||
|
|
||||||
decodedAs :: forall ct a m. (MimeUnrender ct a, RunClient m)
|
decodedAs :: forall ct a m. (MimeUnrender ct a, RunClient m)
|
||||||
=> Response -> Proxy ct -> m a
|
=> Response -> Proxy ct -> m a
|
||||||
|
|
|
@ -43,16 +43,13 @@ library
|
||||||
, http-types >= 0.8.6 && < 0.10
|
, http-types >= 0.8.6 && < 0.10
|
||||||
, exceptions >= 0.8 && < 0.9
|
, exceptions >= 0.8 && < 0.9
|
||||||
, monad-control >= 1.0.0.4 && < 1.1
|
, monad-control >= 1.0.0.4 && < 1.1
|
||||||
, mtl >= 2.2 && < 2.3
|
, mtl >= 2.1 && < 2.3
|
||||||
, semigroupoids >= 4.3 && < 5.3
|
, semigroupoids >= 4.3 && < 5.3
|
||||||
, servant-client-core == 0.11.*
|
, servant-client-core == 0.11.*
|
||||||
, text >= 1.2 && < 1.3
|
, text >= 1.2 && < 1.3
|
||||||
, transformers >= 0.3 && < 0.6
|
, transformers >= 0.3 && < 0.6
|
||||||
, transformers-base >= 0.4.4 && < 0.5
|
, transformers-base >= 0.4.4 && < 0.5
|
||||||
, transformers-compat >= 0.4 && < 0.6
|
, transformers-compat >= 0.4 && < 0.6
|
||||||
if !impl(ghc >= 8.0)
|
|
||||||
build-depends:
|
|
||||||
semigroups >=0.16.2.2 && <0.19
|
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
|
|
@ -155,3 +155,5 @@ test-suite doctests
|
||||||
include-dirs: include
|
include-dirs: include
|
||||||
x-doctest-source-dirs: test
|
x-doctest-source-dirs: test
|
||||||
x-doctest-modules: Servant.Utils.LinksSpec
|
x-doctest-modules: Servant.Utils.LinksSpec
|
||||||
|
other-modules:
|
||||||
|
Build_doctests
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
resolver: nightly-2017-09-01
|
resolver: nightly-2017-09-13
|
||||||
packages:
|
packages:
|
||||||
- servant-client/
|
- servant-client/
|
||||||
- servant-client-core/
|
- servant-client-core/
|
||||||
|
|
Loading…
Reference in a new issue