From a0834a0ee7bafaf802f58fb31f6a0a684b4e43ef Mon Sep 17 00:00:00 2001 From: Dmitry Olshansky Date: Wed, 14 Aug 2024 13:34:19 +0300 Subject: [PATCH] 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