From a0834a0ee7bafaf802f58fb31f6a0a684b4e43ef Mon Sep 17 00:00:00 2001 From: Dmitry Olshansky Date: Wed, 14 Aug 2024 13:34:19 +0300 Subject: [PATCH 1/2] Add instance HasServer (EmptyAPI :> api) context --- servant-server/src/Servant/Server/Internal.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/servant-server/src/Servant/Server/Internal.hs b/servant-server/src/Servant/Server/Internal.hs index 965c626f2..a2818d18b 100644 --- a/servant-server/src/Servant/Server/Internal.hs +++ b/servant-server/src/Servant/Server/Internal.hs @@ -641,7 +641,7 @@ instance -- -- The way the object is constructed from the extracted fields can be controlled by -- providing an instance on @'FromDeepQuery'@ --- +-- -- Example: -- -- > type MyApi = "books" :> DeepQuery "filter" BookQuery :> Get '[JSON] [Book] @@ -914,6 +914,13 @@ instance HasServer EmptyAPI context where hoistServerWithContext _ _ _ = retag +-- | Ignore @'EmptyAPI'@ as part of route in server handlers. +instance HasServer api context => HasServer (EmptyAPI :> api) context where + type ServerT (EmptyAPI :> api) m = ServerT api m + + route _ = route (Proxy :: Proxy api) + hoistServerWithContext _ = hoistServerWithContext (Proxy :: Proxy api) + -- | Basic Authentication instance ( KnownSymbol realm , HasServer api context From 8dc751829dae6e9df52e05ed0a977ed4bd8a004f Mon Sep 17 00:00:00 2001 From: Dmitry Olshansky Date: Wed, 14 Aug 2024 14:35:14 +0300 Subject: [PATCH 2/2] add changelog --- changelog.d/1775 | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelog.d/1775 diff --git a/changelog.d/1775 b/changelog.d/1775 new file mode 100644 index 000000000..4bf712116 --- /dev/null +++ b/changelog.d/1775 @@ -0,0 +1,2 @@ +synopsis: Add instance `HasServer (EmptyAPI :> api) context` +prs: #1775