Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support GHC-9.4 #1592

Merged
merged 7 commits into from Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/master.yml
Expand Up @@ -20,6 +20,7 @@ jobs:
- "8.10.7"
- "9.0.2"
- "9.2.2"
- "9.4.2"

steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 5 additions & 0 deletions cabal.project
Expand Up @@ -51,3 +51,8 @@ packages:
tests: True
optimization: False
-- reorder-goals: True

allow-newer:
-- see https://github.com/haskellari/postgresql-simple/issues/104
postgresql-simple:base
, postgresql-simple:template-haskell
2 changes: 1 addition & 1 deletion servant-auth/servant-auth-client/servant-auth-client.cabal
Expand Up @@ -31,7 +31,7 @@ library
default-extensions: ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators
ghc-options: -Wall
build-depends:
base >= 4.10 && < 4.17
base >= 4.10 && < 4.18
, bytestring >= 0.10.6.0 && < 0.12
, containers >= 0.5.6.2 && < 0.7
, servant-auth == 0.4.*
Expand Down
4 changes: 2 additions & 2 deletions servant-auth/servant-auth-docs/servant-auth-docs.cabal
Expand Up @@ -35,7 +35,7 @@ library
default-extensions: ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators
ghc-options: -Wall
build-depends:
base >= 4.10 && < 4.17
base >= 4.10 && < 4.18
, servant-docs >= 0.11.2 && < 0.13
, servant >= 0.13 && < 0.20
, servant-auth == 0.4.*
Expand All @@ -50,7 +50,7 @@ test-suite doctests
build-depends:
base,
servant-auth-docs,
doctest >= 0.16 && < 0.19,
doctest >= 0.16 && < 0.21,
QuickCheck >= 2.11.3 && < 2.15,
template-haskell
ghc-options: -Wall -threaded
Expand Down
6 changes: 3 additions & 3 deletions servant-auth/servant-auth-server/servant-auth-server.cabal
Expand Up @@ -31,7 +31,7 @@ library
default-extensions: ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators
ghc-options: -Wall
build-depends:
base >= 4.10 && < 4.17
base >= 4.10 && < 4.18
, aeson >= 1.0.0.1 && < 3
, base64-bytestring >= 1.0.0.1 && < 2
, blaze-builder >= 0.4.1.0 && < 0.5
Expand All @@ -43,15 +43,15 @@ library
, http-types >= 0.12.2 && < 0.13
, jose >= 0.7.0.0 && < 0.10
, lens >= 4.16.1 && < 5.3
, memory >= 0.14.16 && < 0.18
, memory >= 0.14.16 && < 0.19
, monad-time >= 0.3.1.0 && < 0.4
, mtl >= 2.2.2 && < 2.3
, servant >= 0.13 && < 0.20
, servant-auth == 0.4.*
, servant-server >= 0.13 && < 0.20
, tagged >= 0.8.4 && < 0.9
, text >= 1.2.3.0 && < 2.1
, time >= 1.5.0.1 && < 1.12
, time >= 1.5.0.1 && < 1.13
, unordered-containers >= 0.2.9.0 && < 0.3
, wai >= 3.2.1.2 && < 3.3

Expand Down
Expand Up @@ -31,7 +31,7 @@ library
default-extensions: ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators
ghc-options: -Wall
build-depends:
base >= 4.10 && < 4.17
base >= 4.10 && < 4.18
, text >= 1.2.3.0 && < 2.1
, servant-swagger >= 1.1.5 && < 2
, swagger2 >= 2.2.2 && < 3
Expand Down
2 changes: 1 addition & 1 deletion servant-auth/servant-auth/servant-auth.cabal
Expand Up @@ -33,7 +33,7 @@ library
default-extensions: ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators
ghc-options: -Wall
build-depends:
base >= 4.10 && < 4.17
base >= 4.10 && < 4.18
, containers >= 0.6 && < 0.7
, aeson >= 1.3.1.1 && < 3
, jose >= 0.7.0.0 && < 0.10
Expand Down
4 changes: 2 additions & 2 deletions servant-client-core/servant-client-core.cabal
Expand Up @@ -50,14 +50,14 @@ library
--
-- note: mtl lower bound is so low because of GHC-7.8
build-depends:
base >= 4.9 && < 4.17
base >= 4.9 && < 4.18
, bytestring >= 0.10.8.1 && < 0.12
, constraints >= 0.2 && < 0.14
, containers >= 0.5.7.1 && < 0.7
, deepseq >= 1.4.2.0 && < 1.5
, text >= 1.2.3.0 && < 2.1
, transformers >= 0.5.2.0 && < 0.6
, template-haskell >= 2.11.1.0 && < 2.19
, template-haskell >= 2.11.1.0 && < 2.20

if !impl(ghc >= 8.2)
build-depends:
Expand Down
4 changes: 2 additions & 2 deletions servant-client/servant-client.cabal
Expand Up @@ -41,14 +41,14 @@ library
-- Bundled with GHC: Lower bound to not force re-installs
-- text and mtl are bundled starting with GHC-8.4
build-depends:
base >= 4.9 && < 4.17
base >= 4.9 && < 4.18
, bytestring >= 0.10.8.1 && < 0.12
, containers >= 0.5.7.1 && < 0.7
, deepseq >= 1.4.2.0 && < 1.5
, mtl >= 2.2.2 && < 2.3
, stm >= 2.4.5.1 && < 2.6
, text >= 1.2.3.0 && < 2.1
, time >= 1.6.0.1 && < 1.12
, time >= 1.6.0.1 && < 1.13
, transformers >= 0.5.2.0 && < 0.6

if !impl(ghc >= 8.2)
Expand Down
2 changes: 1 addition & 1 deletion servant-docs/servant-docs.cabal
Expand Up @@ -41,7 +41,7 @@ library
--
-- note: mtl lower bound is so low because of GHC-7.8
build-depends:
base >= 4.9 && < 4.17
base >= 4.9 && < 4.18
, bytestring >= 0.10.8.1 && < 0.12
, text >= 1.2.3.0 && < 2.1

Expand Down
2 changes: 1 addition & 1 deletion servant-foreign/servant-foreign.cabal
Expand Up @@ -41,7 +41,7 @@ library
--
-- note: mtl lower bound is so low because of GHC-7.8
build-depends:
base >= 4.9 && < 4.17
base >= 4.9 && < 4.18
, text >= 1.2.3.0 && < 2.1

-- Servant dependencies
Expand Down
4 changes: 2 additions & 2 deletions servant-http-streams/servant-http-streams.cabal
Expand Up @@ -38,13 +38,13 @@ library
-- Bundled with GHC: Lower bound to not force re-installs
-- text and mtl are bundled starting with GHC-8.4
build-depends:
base >= 4.9 && < 4.17
base >= 4.9 && < 4.18
, bytestring >= 0.10.8.1 && < 0.12
, containers >= 0.5.7.1 && < 0.7
, deepseq >= 1.4.2.0 && < 1.5
, mtl >= 2.2.2 && < 2.3
, text >= 1.2.3.0 && < 2.1
, time >= 1.6.0.1 && < 1.12
, time >= 1.6.0.1 && < 1.13
, transformers >= 0.5.2.0 && < 0.6

if !impl(ghc >= 8.2)
Expand Down
4 changes: 2 additions & 2 deletions servant-server/servant-server.cabal
Expand Up @@ -60,7 +60,7 @@ library
-- Bundled with GHC: Lower bound to not force re-installs
-- text and mtl are bundled starting with GHC-8.4
build-depends:
base >= 4.9 && < 4.17
base >= 4.9 && < 4.18
, bytestring >= 0.10.8.1 && < 0.12
, constraints >= 0.2 && < 0.14
, containers >= 0.5.7.1 && < 0.7
Expand All @@ -73,7 +73,7 @@ library
-- strict dependency as we re-export 'servant' things.
build-depends:
servant >= 0.19 && < 0.20
, http-api-data >= 0.4.1 && < 0.4.4
, http-api-data >= 0.4.1 && < 0.5.1

-- Other dependencies: Lower bound around what is in the latest Stackage LTS.
-- Here can be exceptions if we really need features from the newer versions.
Expand Down
15 changes: 13 additions & 2 deletions servant-server/src/Servant/Server/Internal.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
Expand Down Expand Up @@ -94,6 +95,8 @@ import Servant.API.TypeErrors
import Web.HttpApiData
(FromHttpApiData, parseHeader, parseQueryParam, parseUrlPiece,
parseUrlPieces)
import Data.Kind
(Type)

import Servant.Server.Internal.BasicAuth
import Servant.Server.Internal.Context
Expand Down Expand Up @@ -821,7 +824,11 @@ instance (HasContextEntry context (NamedContext name subContext), HasServer subA
-------------------------------------------------------------------------------

-- Erroring instance for 'HasServer' when a combinator is not fully applied
instance TypeError (PartialApplication HasServer arr) => HasServer ((arr :: a -> b) :> sub) context
instance TypeError (PartialApplication
#if __GLASGOW_HASKELL__ >= 904
@(Type -> [Type] -> Constraint)
#endif
HasServer arr) => HasServer ((arr :: a -> b) :> sub) context
where
type ServerT (arr :> sub) _ = TypeError (PartialApplication (HasServer :: * -> [*] -> Constraint) arr)
route = error "unreachable"
Expand Down Expand Up @@ -865,7 +872,11 @@ type HasServerArrowTypeError a b =
-- XXX: This omits the @context@ parameter, e.g.:
--
-- "There is no instance for HasServer (Bool :> …)". Do we care ?
instance {-# OVERLAPPABLE #-} TypeError (NoInstanceForSub HasServer ty) => HasServer (ty :> sub) context
instance {-# OVERLAPPABLE #-} TypeError (NoInstanceForSub
#if __GLASGOW_HASKELL__ >= 904
@(Type -> [Type] -> Constraint)
#endif
HasServer ty) => HasServer (ty :> sub) context

instance {-# OVERLAPPABLE #-} TypeError (NoInstanceFor (HasServer api context)) => HasServer api context

Expand Down
4 changes: 2 additions & 2 deletions servant/servant.cabal
Expand Up @@ -80,7 +80,7 @@ library
--
-- note: mtl lower bound is so low because of GHC-7.8
build-depends:
base >= 4.9 && < 4.17
base >= 4.9 && < 4.18
, bytestring >= 0.10.8.1 && < 0.12
, constraints >= 0.2
, mtl >= 2.2.2 && < 2.3
Expand All @@ -92,7 +92,7 @@ library
-- We depend (heavily) on the API of these packages:
-- i.e. re-export, or allow using without direct dependency
build-depends:
http-api-data >= 0.4.1 && < 0.4.4
http-api-data >= 0.4.1 && < 0.5.1
, singleton-bool >= 0.1.4 && < 0.1.7

-- Other dependencies: Lower bound around what is in the latest Stackage LTS.
Expand Down
6 changes: 3 additions & 3 deletions servant/src/Servant/API/TypeLevel.hs
Expand Up @@ -110,7 +110,7 @@ type family IsElem' a s :: Constraint
--
-- >>> ok (Proxy :: Proxy (IsElem ("bye" :> Get '[JSON] Int) SampleAPI))
-- ...
-- ... Could not deduce...
-- ... Could not ...
-- ...
--
-- An endpoint is considered within an api even if it is missing combinators
Expand Down Expand Up @@ -151,7 +151,7 @@ type family IsElem endpoint api :: Constraint where
--
-- >>> ok (Proxy :: Proxy (IsSubAPI (SampleAPI :<|> Get '[JSON] Int) SampleAPI))
-- ...
-- ... Could not deduce...
-- ... Could not ...
-- ...
--
-- This uses @IsElem@ for checking; thus the note there applies here.
Expand All @@ -174,7 +174,7 @@ type family AllIsElem xs api :: Constraint where
--
-- >>> ok (Proxy :: Proxy (IsIn (Get '[JSON] Int) (Header "h" Bool :> Get '[JSON] Int)))
-- ...
-- ... Could not deduce...
-- ... Could not ...
-- ...
type family IsIn (endpoint :: *) (api :: *) :: Constraint where
IsIn e (sa :<|> sb) = Or (IsIn e sa) (IsIn e sb)
Expand Down
17 changes: 14 additions & 3 deletions servant/src/Servant/Links.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
Expand Down Expand Up @@ -91,7 +92,7 @@
-- >>> let bad_link = Proxy :: Proxy ("hello" :> Delete '[JSON] NoContent)
-- >>> safeLink api bad_link
-- ...
-- ...Could not deduce...
-- ...Could not ...
-- ...
--
-- This error is essentially saying that the type family couldn't find
Expand Down Expand Up @@ -193,6 +194,8 @@ import Servant.API.Verbs
import Servant.API.WithNamedContext
(WithNamedContext)
import Web.HttpApiData
import Data.Kind
(Type)

-- | A safe link datatype.
-- The only way of constructing a 'Link' is using 'safeLink', which means any
Expand Down Expand Up @@ -647,12 +650,20 @@ simpleToLink _ toA _ = toLink toA (Proxy :: Proxy sub)
-- >>> import Data.Text (Text)

-- Erroring instance for 'HasLink' when a combinator is not fully applied
instance TypeError (PartialApplication HasLink arr) => HasLink ((arr :: a -> b) :> sub)
instance TypeError (PartialApplication
#if __GLASGOW_HASKELL__ >= 904
@(Type -> Constraint)
#endif
HasLink arr) => HasLink ((arr :: a -> b) :> sub)
where
type MkLink (arr :> sub) _ = TypeError (PartialApplication (HasLink :: * -> Constraint) arr)
toLink = error "unreachable"

-- Erroring instances for 'HasLink' for unknown API combinators
instance {-# OVERLAPPABLE #-} TypeError (NoInstanceForSub HasLink ty) => HasLink (ty :> sub)
instance {-# OVERLAPPABLE #-} TypeError (NoInstanceForSub
#if __GLASGOW_HASKELL__ >= 904
@(Type -> Constraint)
#endif
HasLink ty) => HasLink (ty :> sub)

instance {-# OVERLAPPABLE #-} TypeError (NoInstanceFor (HasLink api)) => HasLink api