commit
d5b9cbf634
17 changed files with 56 additions and 28 deletions
1
.github/workflows/master.yml
vendored
1
.github/workflows/master.yml
vendored
|
@ -20,6 +20,7 @@ jobs:
|
|||
- "8.10.7"
|
||||
- "9.0.2"
|
||||
- "9.2.2"
|
||||
- "9.4.2"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.*
|
||||
|
|
|
@ -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.*
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -43,7 +43,7 @@ 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
|
||||
|
@ -51,7 +51,7 @@ library
|
|||
, 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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
@ -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.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{-# LANGUAGE AllowAmbiguousTypes #-}
|
||||
{-# LANGUAGE ConstraintKinds #-}
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE DeriveDataTypeable #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{-# LANGUAGE AllowAmbiguousTypes #-}
|
||||
{-# LANGUAGE ConstraintKinds #-}
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue