Merge branch 'master' into http-api-data-0.5
This commit is contained in:
commit
cf85cffa77
18 changed files with 61 additions and 28 deletions
1
.github/workflows/master.yml
vendored
1
.github/workflows/master.yml
vendored
|
@ -20,6 +20,7 @@ jobs:
|
||||||
- "8.10.7"
|
- "8.10.7"
|
||||||
- "9.0.2"
|
- "9.0.2"
|
||||||
- "9.2.2"
|
- "9.2.2"
|
||||||
|
- "9.4.2"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
|
@ -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
|
default-extensions: ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.10 && < 4.17
|
base >= 4.10 && < 4.18
|
||||||
, bytestring >= 0.10.6.0 && < 0.12
|
, bytestring >= 0.10.6.0 && < 0.12
|
||||||
, containers >= 0.5.6.2 && < 0.7
|
, containers >= 0.5.6.2 && < 0.7
|
||||||
, servant-auth == 0.4.*
|
, 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
|
default-extensions: ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.10 && < 4.17
|
base >= 4.10 && < 4.18
|
||||||
, servant-docs >= 0.11.2 && < 0.13
|
, servant-docs >= 0.11.2 && < 0.13
|
||||||
, servant >= 0.13 && < 0.20
|
, servant >= 0.13 && < 0.20
|
||||||
, servant-auth == 0.4.*
|
, servant-auth == 0.4.*
|
||||||
|
@ -50,7 +50,7 @@ test-suite doctests
|
||||||
build-depends:
|
build-depends:
|
||||||
base,
|
base,
|
||||||
servant-auth-docs,
|
servant-auth-docs,
|
||||||
doctest >= 0.16 && < 0.19,
|
doctest >= 0.16 && < 0.21,
|
||||||
QuickCheck >= 2.11.3 && < 2.15,
|
QuickCheck >= 2.11.3 && < 2.15,
|
||||||
template-haskell
|
template-haskell
|
||||||
ghc-options: -Wall -threaded
|
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
|
default-extensions: ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.10 && < 4.17
|
base >= 4.10 && < 4.18
|
||||||
, aeson >= 1.0.0.1 && < 3
|
, aeson >= 1.0.0.1 && < 3
|
||||||
, base64-bytestring >= 1.0.0.1 && < 2
|
, base64-bytestring >= 1.0.0.1 && < 2
|
||||||
, blaze-builder >= 0.4.1.0 && < 0.5
|
, blaze-builder >= 0.4.1.0 && < 0.5
|
||||||
|
@ -43,7 +43,7 @@ library
|
||||||
, http-types >= 0.12.2 && < 0.13
|
, http-types >= 0.12.2 && < 0.13
|
||||||
, jose >= 0.7.0.0 && < 0.10
|
, jose >= 0.7.0.0 && < 0.10
|
||||||
, lens >= 4.16.1 && < 5.3
|
, 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
|
, monad-time >= 0.3.1.0 && < 0.4
|
||||||
, mtl >= 2.2.2 && < 2.3
|
, mtl >= 2.2.2 && < 2.3
|
||||||
, servant >= 0.13 && < 0.20
|
, servant >= 0.13 && < 0.20
|
||||||
|
@ -51,7 +51,7 @@ library
|
||||||
, servant-server >= 0.13 && < 0.20
|
, servant-server >= 0.13 && < 0.20
|
||||||
, tagged >= 0.8.4 && < 0.9
|
, tagged >= 0.8.4 && < 0.9
|
||||||
, text >= 1.2.3.0 && < 2.1
|
, 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
|
, unordered-containers >= 0.2.9.0 && < 0.3
|
||||||
, wai >= 3.2.1.2 && < 3.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
|
default-extensions: ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.10 && < 4.17
|
base >= 4.10 && < 4.18
|
||||||
, text >= 1.2.3.0 && < 2.1
|
, text >= 1.2.3.0 && < 2.1
|
||||||
, servant-swagger >= 1.1.5 && < 2
|
, servant-swagger >= 1.1.5 && < 2
|
||||||
, swagger2 >= 2.2.2 && < 3
|
, 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
|
default-extensions: ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.10 && < 4.17
|
base >= 4.10 && < 4.18
|
||||||
, containers >= 0.6 && < 0.7
|
, containers >= 0.6 && < 0.7
|
||||||
, aeson >= 1.3.1.1 && < 3
|
, aeson >= 1.3.1.1 && < 3
|
||||||
, jose >= 0.7.0.0 && < 0.10
|
, jose >= 0.7.0.0 && < 0.10
|
||||||
|
|
|
@ -50,14 +50,14 @@ library
|
||||||
--
|
--
|
||||||
-- note: mtl lower bound is so low because of GHC-7.8
|
-- note: mtl lower bound is so low because of GHC-7.8
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.9 && < 4.17
|
base >= 4.9 && < 4.18
|
||||||
, bytestring >= 0.10.8.1 && < 0.12
|
, bytestring >= 0.10.8.1 && < 0.12
|
||||||
, constraints >= 0.2 && < 0.14
|
, constraints >= 0.2 && < 0.14
|
||||||
, containers >= 0.5.7.1 && < 0.7
|
, containers >= 0.5.7.1 && < 0.7
|
||||||
, deepseq >= 1.4.2.0 && < 1.5
|
, deepseq >= 1.4.2.0 && < 1.5
|
||||||
, text >= 1.2.3.0 && < 2.1
|
, text >= 1.2.3.0 && < 2.1
|
||||||
, transformers >= 0.5.2.0 && < 0.6
|
, 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)
|
if !impl(ghc >= 8.2)
|
||||||
build-depends:
|
build-depends:
|
||||||
|
|
|
@ -41,14 +41,14 @@ library
|
||||||
-- Bundled with GHC: Lower bound to not force re-installs
|
-- Bundled with GHC: Lower bound to not force re-installs
|
||||||
-- text and mtl are bundled starting with GHC-8.4
|
-- text and mtl are bundled starting with GHC-8.4
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.9 && < 4.17
|
base >= 4.9 && < 4.18
|
||||||
, bytestring >= 0.10.8.1 && < 0.12
|
, bytestring >= 0.10.8.1 && < 0.12
|
||||||
, containers >= 0.5.7.1 && < 0.7
|
, containers >= 0.5.7.1 && < 0.7
|
||||||
, deepseq >= 1.4.2.0 && < 1.5
|
, deepseq >= 1.4.2.0 && < 1.5
|
||||||
, mtl >= 2.2.2 && < 2.3
|
, mtl >= 2.2.2 && < 2.3
|
||||||
, stm >= 2.4.5.1 && < 2.6
|
, stm >= 2.4.5.1 && < 2.6
|
||||||
, text >= 1.2.3.0 && < 2.1
|
, 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
|
, transformers >= 0.5.2.0 && < 0.6
|
||||||
|
|
||||||
if !impl(ghc >= 8.2)
|
if !impl(ghc >= 8.2)
|
||||||
|
|
|
@ -41,7 +41,7 @@ library
|
||||||
--
|
--
|
||||||
-- note: mtl lower bound is so low because of GHC-7.8
|
-- note: mtl lower bound is so low because of GHC-7.8
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.9 && < 4.17
|
base >= 4.9 && < 4.18
|
||||||
, bytestring >= 0.10.8.1 && < 0.12
|
, bytestring >= 0.10.8.1 && < 0.12
|
||||||
, text >= 1.2.3.0 && < 2.1
|
, text >= 1.2.3.0 && < 2.1
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ library
|
||||||
--
|
--
|
||||||
-- note: mtl lower bound is so low because of GHC-7.8
|
-- note: mtl lower bound is so low because of GHC-7.8
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.9 && < 4.17
|
base >= 4.9 && < 4.18
|
||||||
, text >= 1.2.3.0 && < 2.1
|
, text >= 1.2.3.0 && < 2.1
|
||||||
|
|
||||||
-- Servant dependencies
|
-- Servant dependencies
|
||||||
|
|
|
@ -38,13 +38,13 @@ library
|
||||||
-- Bundled with GHC: Lower bound to not force re-installs
|
-- Bundled with GHC: Lower bound to not force re-installs
|
||||||
-- text and mtl are bundled starting with GHC-8.4
|
-- text and mtl are bundled starting with GHC-8.4
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.9 && < 4.17
|
base >= 4.9 && < 4.18
|
||||||
, bytestring >= 0.10.8.1 && < 0.12
|
, bytestring >= 0.10.8.1 && < 0.12
|
||||||
, containers >= 0.5.7.1 && < 0.7
|
, containers >= 0.5.7.1 && < 0.7
|
||||||
, deepseq >= 1.4.2.0 && < 1.5
|
, deepseq >= 1.4.2.0 && < 1.5
|
||||||
, mtl >= 2.2.2 && < 2.3
|
, mtl >= 2.2.2 && < 2.3
|
||||||
, text >= 1.2.3.0 && < 2.1
|
, 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
|
, transformers >= 0.5.2.0 && < 0.6
|
||||||
|
|
||||||
if !impl(ghc >= 8.2)
|
if !impl(ghc >= 8.2)
|
||||||
|
|
|
@ -3,6 +3,11 @@
|
||||||
|
|
||||||
Package versions follow the [Package Versioning Policy](https://pvp.haskell.org/): in A.B.C, bumps to either A or B represent major versions.
|
Package versions follow the [Package Versioning Policy](https://pvp.haskell.org/): in A.B.C, bumps to either A or B represent major versions.
|
||||||
|
|
||||||
|
0.19.2
|
||||||
|
------
|
||||||
|
|
||||||
|
Compatibility with GHC 9.4, see [PR #1592](https://github.com/haskell-servant/servant/pull/1592).
|
||||||
|
|
||||||
0.19.1
|
0.19.1
|
||||||
------
|
------
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
cabal-version: 2.2
|
cabal-version: 2.2
|
||||||
name: servant-server
|
name: servant-server
|
||||||
version: 0.19.1
|
version: 0.19.2
|
||||||
|
|
||||||
synopsis: A family of combinators for defining webservices APIs and serving them
|
synopsis: A family of combinators for defining webservices APIs and serving them
|
||||||
category: Servant, Web
|
category: Servant, Web
|
||||||
|
@ -60,7 +60,7 @@ library
|
||||||
-- Bundled with GHC: Lower bound to not force re-installs
|
-- Bundled with GHC: Lower bound to not force re-installs
|
||||||
-- text and mtl are bundled starting with GHC-8.4
|
-- text and mtl are bundled starting with GHC-8.4
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.9 && < 4.17
|
base >= 4.9 && < 4.18
|
||||||
, bytestring >= 0.10.8.1 && < 0.12
|
, bytestring >= 0.10.8.1 && < 0.12
|
||||||
, constraints >= 0.2 && < 0.14
|
, constraints >= 0.2 && < 0.14
|
||||||
, containers >= 0.5.7.1 && < 0.7
|
, containers >= 0.5.7.1 && < 0.7
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{-# LANGUAGE AllowAmbiguousTypes #-}
|
{-# LANGUAGE AllowAmbiguousTypes #-}
|
||||||
{-# LANGUAGE ConstraintKinds #-}
|
{-# LANGUAGE ConstraintKinds #-}
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE DataKinds #-}
|
{-# LANGUAGE DataKinds #-}
|
||||||
{-# LANGUAGE DeriveDataTypeable #-}
|
{-# LANGUAGE DeriveDataTypeable #-}
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
|
@ -94,6 +95,8 @@ import Servant.API.TypeErrors
|
||||||
import Web.HttpApiData
|
import Web.HttpApiData
|
||||||
(FromHttpApiData, parseHeader, parseQueryParam, parseUrlPiece,
|
(FromHttpApiData, parseHeader, parseQueryParam, parseUrlPiece,
|
||||||
parseUrlPieces)
|
parseUrlPieces)
|
||||||
|
import Data.Kind
|
||||||
|
(Type)
|
||||||
|
|
||||||
import Servant.Server.Internal.BasicAuth
|
import Servant.Server.Internal.BasicAuth
|
||||||
import Servant.Server.Internal.Context
|
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
|
-- 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
|
where
|
||||||
type ServerT (arr :> sub) _ = TypeError (PartialApplication (HasServer :: * -> [*] -> Constraint) arr)
|
type ServerT (arr :> sub) _ = TypeError (PartialApplication (HasServer :: * -> [*] -> Constraint) arr)
|
||||||
route = error "unreachable"
|
route = error "unreachable"
|
||||||
|
@ -865,7 +872,11 @@ type HasServerArrowTypeError a b =
|
||||||
-- XXX: This omits the @context@ parameter, e.g.:
|
-- XXX: This omits the @context@ parameter, e.g.:
|
||||||
--
|
--
|
||||||
-- "There is no instance for HasServer (Bool :> …)". Do we care ?
|
-- "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
|
instance {-# OVERLAPPABLE #-} TypeError (NoInstanceFor (HasServer api context)) => HasServer api context
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,11 @@
|
||||||
|
|
||||||
Package versions follow the [Package Versioning Policy](https://pvp.haskell.org/): in A.B.C, bumps to either A or B represent major versions.
|
Package versions follow the [Package Versioning Policy](https://pvp.haskell.org/): in A.B.C, bumps to either A or B represent major versions.
|
||||||
|
|
||||||
|
0.19.1
|
||||||
|
------
|
||||||
|
|
||||||
|
Compatibility with GHC 9.4, see [PR #1592](https://github.com/haskell-servant/servant/pull/1592).
|
||||||
|
|
||||||
0.19
|
0.19
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
cabal-version: 2.2
|
cabal-version: 2.2
|
||||||
name: servant
|
name: servant
|
||||||
version: 0.19
|
version: 0.19.1
|
||||||
|
|
||||||
synopsis: A family of combinators for defining webservices APIs
|
synopsis: A family of combinators for defining webservices APIs
|
||||||
category: Servant, Web
|
category: Servant, Web
|
||||||
|
@ -80,7 +80,7 @@ library
|
||||||
--
|
--
|
||||||
-- note: mtl lower bound is so low because of GHC-7.8
|
-- note: mtl lower bound is so low because of GHC-7.8
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.9 && < 4.17
|
base >= 4.9 && < 4.18
|
||||||
, bytestring >= 0.10.8.1 && < 0.12
|
, bytestring >= 0.10.8.1 && < 0.12
|
||||||
, constraints >= 0.2
|
, constraints >= 0.2
|
||||||
, mtl >= 2.2.2 && < 2.3
|
, mtl >= 2.2.2 && < 2.3
|
||||||
|
|
|
@ -110,7 +110,7 @@ type family IsElem' a s :: Constraint
|
||||||
--
|
--
|
||||||
-- >>> ok (Proxy :: Proxy (IsElem ("bye" :> Get '[JSON] Int) SampleAPI))
|
-- >>> 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
|
-- 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))
|
-- >>> 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.
|
-- 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)))
|
-- >>> 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
|
type family IsIn (endpoint :: *) (api :: *) :: Constraint where
|
||||||
IsIn e (sa :<|> sb) = Or (IsIn e sa) (IsIn e sb)
|
IsIn e (sa :<|> sb) = Or (IsIn e sa) (IsIn e sb)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{-# LANGUAGE AllowAmbiguousTypes #-}
|
{-# LANGUAGE AllowAmbiguousTypes #-}
|
||||||
{-# LANGUAGE ConstraintKinds #-}
|
{-# LANGUAGE ConstraintKinds #-}
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE DataKinds #-}
|
{-# LANGUAGE DataKinds #-}
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
|
@ -91,7 +92,7 @@
|
||||||
-- >>> let bad_link = Proxy :: Proxy ("hello" :> Delete '[JSON] NoContent)
|
-- >>> let bad_link = Proxy :: Proxy ("hello" :> Delete '[JSON] NoContent)
|
||||||
-- >>> safeLink api bad_link
|
-- >>> safeLink api bad_link
|
||||||
-- ...
|
-- ...
|
||||||
-- ...Could not deduce...
|
-- ...Could not ...
|
||||||
-- ...
|
-- ...
|
||||||
--
|
--
|
||||||
-- This error is essentially saying that the type family couldn't find
|
-- This error is essentially saying that the type family couldn't find
|
||||||
|
@ -193,6 +194,8 @@ import Servant.API.Verbs
|
||||||
import Servant.API.WithNamedContext
|
import Servant.API.WithNamedContext
|
||||||
(WithNamedContext)
|
(WithNamedContext)
|
||||||
import Web.HttpApiData
|
import Web.HttpApiData
|
||||||
|
import Data.Kind
|
||||||
|
(Type)
|
||||||
|
|
||||||
-- | A safe link datatype.
|
-- | A safe link datatype.
|
||||||
-- The only way of constructing a 'Link' is using 'safeLink', which means any
|
-- 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)
|
-- >>> import Data.Text (Text)
|
||||||
|
|
||||||
-- Erroring instance for 'HasLink' when a combinator is not fully applied
|
-- 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
|
where
|
||||||
type MkLink (arr :> sub) _ = TypeError (PartialApplication (HasLink :: * -> Constraint) arr)
|
type MkLink (arr :> sub) _ = TypeError (PartialApplication (HasLink :: * -> Constraint) arr)
|
||||||
toLink = error "unreachable"
|
toLink = error "unreachable"
|
||||||
|
|
||||||
-- Erroring instances for 'HasLink' for unknown API combinators
|
-- 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
|
instance {-# OVERLAPPABLE #-} TypeError (NoInstanceFor (HasLink api)) => HasLink api
|
||||||
|
|
Loading…
Reference in a new issue