Ghc 8.2 fixes

This commit is contained in:
Julian K. Arni 2017-09-14 09:53:51 -04:00
parent da8337809b
commit 39ad465695
6 changed files with 18 additions and 13 deletions

View File

@ -44,11 +44,14 @@ library
, http-api-data >= 0.3.6 && < 0.4
, http-media >= 0.6.2 && < 0.8
, http-types >= 0.8.6 && < 0.10
, mtl >= 2.2 && < 2.3
, mtl >= 2.1 && < 2.3
, network-uri >= 2.6 && < 2.7
, safe >= 0.3.9 && < 0.4
, servant == 0.11.*
, text >= 1.2 && < 1.3
if !impl(ghc >= 8.0)
build-depends:
semigroups >=0.16.2.2 && <0.19
hs-source-dirs: src
default-language: Haskell2010
ghc-options: -Wall
@ -66,6 +69,6 @@ test-suite spec
, deepseq
, servant-client-core
, hspec == 2.*
, QuickCheck >= 2.7 && < 2.10
, QuickCheck >= 2.7 && < 2.11
other-modules:
Servant.Client.Core.Internal.BaseUrlSpec

View File

@ -14,6 +14,8 @@
#include "overlapping-compat.h"
module Servant.Client.Core.Internal.HasClient where
import Prelude.Compat
import Prelude ()
import Control.Monad.Error.Class (throwError)
import Data.List (foldl')
@ -23,8 +25,6 @@ import Data.Text (pack)
import GHC.Exts (fromList, toList)
import GHC.TypeLits (KnownSymbol, symbolVal)
import qualified Network.HTTP.Types as H
import Prelude ()
import Prelude.Compat
import Servant.API ((:<|>) ((:<|>)), (:>),
AuthProtect, BasicAuth,
BasicAuthData,

View File

@ -1,13 +1,17 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE OverloadedStrings #-}
-- | Types for possible backends to run client-side `Request` queries
module Servant.Client.Core.Internal.RunClient where
import Prelude.Compat
import Prelude ()
import Control.Monad (unless)
import Control.Monad.Error.Class (MonadError, throwError)
import Data.Foldable (toList)
import Data.Proxy (Proxy)
import qualified Data.Text as T
import Network.HTTP.Media (MediaType, matches,
@ -17,7 +21,6 @@ import Servant.API (MimeUnrender,
mimeUnrender)
import Servant.Client.Core.Internal.Request (Request, Response (..),
ServantError (..))
import Data.Foldable (toList)
class (MonadError ServantError m) => RunClient m where
-- | How to make a request.
@ -26,10 +29,10 @@ class (MonadError ServantError m) => RunClient m where
checkContentTypeHeader :: RunClient m => Response -> m MediaType
checkContentTypeHeader response =
case lookup "Content-Type" $ toList $ responseHeaders response of
Nothing -> pure $ "application"//"octet-stream"
Nothing -> return $ "application"//"octet-stream"
Just t -> case parseAccept t of
Nothing -> throwError $ InvalidContentTypeHeader response
Just t' -> pure t'
Just t' -> return t'
decodedAs :: forall ct a m. (MimeUnrender ct a, RunClient m)
=> Response -> Proxy ct -> m a

View File

@ -43,16 +43,13 @@ library
, http-types >= 0.8.6 && < 0.10
, exceptions >= 0.8 && < 0.9
, monad-control >= 1.0.0.4 && < 1.1
, mtl >= 2.2 && < 2.3
, mtl >= 2.1 && < 2.3
, semigroupoids >= 4.3 && < 5.3
, servant-client-core == 0.11.*
, text >= 1.2 && < 1.3
, transformers >= 0.3 && < 0.6
, transformers-base >= 0.4.4 && < 0.5
, transformers-compat >= 0.4 && < 0.6
if !impl(ghc >= 8.0)
build-depends:
semigroups >=0.16.2.2 && <0.19
hs-source-dirs: src
default-language: Haskell2010
ghc-options: -Wall

View File

@ -155,3 +155,5 @@ test-suite doctests
include-dirs: include
x-doctest-source-dirs: test
x-doctest-modules: Servant.Utils.LinksSpec
other-modules:
Build_doctests

View File

@ -1,4 +1,4 @@
resolver: nightly-2017-09-01
resolver: nightly-2017-09-13
packages:
- servant-client/
- servant-client-core/